urnathan / libcody Goto Github PK
View Code? Open in Web Editor NEWCompiler/BuildSystem Interface Library
License: Apache License 2.0
Compiler/BuildSystem Interface Library
License: Apache License 2.0
From the README
:
It is expected that absolute header-unit names convert to relative CMI names, to keep all CMIs within the CMI repository. This means that steps must be taken to distinguish the CMIs for
/here
from./here
, and this can be achieved by replacing the leading./
directory with,/
, which is visually similar but does not have the self-reference semantics of dot. Likewise, header-unit names containing..
directories, can be remapped to,,
. (When symlinks are involvedbob/dob/..
might not be bob, of course.) C++ header-unit semantics are such that there is no need to resolve multiple ways of spelling a particular header-unit to a unique CMI file.
Just want to mention the alternative approach that we use in build2
: instead of trying to sanitize the path we hash it and then use the abbreviated hash as the BMI file name. More specifically (comment from the code):
// What should we use as a file/target name? On one hand we want it
// unique enough so that <stdio.h> and <custom/stdio.h> don't end up
// with the same BMI. On the other, we need the same headers resolving
// to the same target, regardless of how they were imported. So it feels
// like the name should be the absolute and normalized (actualized on
// case-insensitive filesystems) header path. We could try to come up
// with something by sanitizing certain characters, etc. But then the
// names will be very long and ugly, they will run into path length
// limits, etc. So instead we will use the file name plus an abbreviated
// hash of the whole path, something like stdio-211321fe6de7.
I think it just assumes that if the compiler accepts some c++11, it is c++11. This has led to some c++14 creeping in :( That's what happens converting a configure for 'is this sufficiently c++20ish'.
I've noticed that the code uses narrow character and string literals while the protocol requires UTF-8. This makes this library unusable on z/OS which uses EBCDIC for narrow literals. In order to actually use UTF-8 literals you need to start them with u8
. This returns char
since C++11 and char8_t
since C++20.
cody builds with -fno-rtti -fno-exceptions, 'cos that;s what GCC needs. It's not right in general and should be configurable.
This error ocured when I make this project:
OS: Ubuntu 18.04 (WSL2)
Parallelizing 4 ways
make -r -j --jobserver-fds=3,4
make[1]: Entering directory '/mnt/d/Code/GCC/libcody'
rm -f .gdbinit ; ln -s gdbinit .gdbinit
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF buffer.d -I . -c -o buffer.o buffer.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF client.d -I . -c -o client.o client.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF netclient.d -I . -c -o netclient.o netclient.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF netserver.d -I . -c -o netserver.o netserver.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF packet.d -I . -c -o packet.o packet.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF resolver.d -I . -c -o resolver.o resolver.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF server.d -I . -c -o server.o server.cc
g++ -g -O2 -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=./= -W -Wall -Woverloaded-virtual -Wshadow -Wno-invalid-offsetof -Wno-unused-variable -Wno-missing-field-initializers -fmessage-length=133 -fdiagnostics-color=always -fno-diagnostics-show-option -include config.h -MMD -MP -MF fatal.d -I . -c -o fatal.o fatal.cc
fatal.cc: In function ‘void Cody::HCF(const char*, Cody::Location)’:
fatal.cc:42:25: error: ‘SRCDIR’ was not declared in this scope
char const *src = SRCDIR;
^~~~~~
fatal.cc:42:25: note: suggested alternative: ‘EISDIR’
char const src = SRCDIR;
^~~~~~
EISDIR
fatal.cc: In function ‘void Cody::BuildNote(FILE)’:
fatal.cc:64:7: error: ‘REVISION’ was not declared in this scope
if (REVISION[0])
^~~~~~~~
fatal.cc:64:7: note: suggested alternative: ‘EISCONN’
if (REVISION[0])
^~~~~~~~
EISCONN
Makefile:87: recipe for target 'fatal.o' failed
make[1]: *** [fatal.o] Error 1
make[1]: Leaving directory '/mnt/d/Code/GCC/libcody'
Makefile:27: recipe for target 'recurse' failed
make: *** [recurse] Error 2
I encountered this issue when building GCC on Solaris.
For some reason, several of the string related functions like to_string and strtoull require that _GLIBCXX_USE_C99 be defined (at least going by the headers :
/usr/gcc/4.8/include/c++/4.8.2/bits/basic_string.h:#if ((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \
)
Is it legal to send a block of responses that is shorter than the block of requests provided the last response is ERROR
? This line from the documentation would suggest that it's not:
The compiler sends a block of one or more requests to the builder, then waits for a block of responses to all of those requests.
On the other hand, it's not always clear what sensible thing a mapper could respond with to the subsequent requests (other than maybe duplicating the same ERROR
for all of them). Perhaps this should be relaxed to allow an incomplete response block provided the last one is an ERROR
? If that causes an undue complexity, then we could further restrict this case by requiring that such an ERROR
be the last response (i.e., followed by EOF).
Reading the protocol description, it's not clear whether the builder is allowed to start sending responses to requests in a block before reading the entire block. In other words, can a dumb builder process one request at a time (making sure to duplicate any ;
in the response)?
This line from the description suggests that the answer is probably a "no", but I think stating this explicitly would be a good idea:
The compiler sends a block of one or more requests to the builder, then waits for a block of responses to all of those requests.
If the answer is indeed a "no", then that's unfortunate since that makes writing prototype mappers (e.g., as a shell script) a lot harder. Perhaps there could be a way to disable batching (e.g., as part of the handshake)?
Hi again
This one looks easier to fix.
g++ -std=c++11 -g -fno-enforce-eh-specs -fno-stack-protector -fno-threadsafe-statics -fno-exceptions -fno-rtti -fdebug-prefix-map=../../libcody/= -W -Wall -include config.h -I../../libcody \
-MMD -MP -MF netclient.d -c -o netclient.o ../../libcody/netclient.cc
../../libcody/netclient.cc: In function 'int Cody::OpenInet6(const char**, const char*, int)':
../../libcody/netclient.cc:114:3: error: 'sockaddr_in6' was not declared in this scope; did you mean 'sockaddr_un'?
114 | sockaddr_in6 addr;
| ^~~~~~~~~~~~
| sockaddr_un
My change to fix this
diff --git a/libcody/netclient.cc b/libcody/netclient.cc
index 8cccface71c..c97ed4ca126 100644
--- a/libcody/netclient.cc
+++ b/libcody/netclient.cc
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/un.h>
+#include <netinet/in.h>
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0
diff --git a/libcody/netserver.cc b/libcody/netserver.cc
index 7e43eb033f4..4e55089161e 100644
--- a/libcody/netserver.cc
+++ b/libcody/netserver.cc
@@ -13,6 +13,7 @@
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/un.h>
+#include <netinet/in.h>
#ifndef AI_NUMERICSERV
#define AI_NUMERICSERV 0
(not sure how OS neutral that header is)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.