c-semantics
c-semantics copied to clipboard
__GNUC__ is not defined
for issue https://github.com/kframework/c-semantics/issues/347
can work around by install lua5.1, then no need to compile the minilua but it will have new problem
in lj_def.h , it need to have the predefined macro __GNUC__, but kcc doesn't have it
Try to define it by adding CFLAGS -D__GNUC__=5. But in the code it keeps undefined. seems we can't define it by this way.
However can define it in the file by #define __GNUC__ 5
small example:
for file main.c
int main(){
int a = __GNUC__;
}
compile by:
kcc main.c
kcc main.c -D__GNUC__=5
both will fail, but gcc will success.
error is:
mian.c:2:3: error: Trying to look up identifier __GNUC__, but no such identifier is in scope.
Syntax error (SE-CID1):
see C11 section 6.5.1:2 http://rvdoc.org/C11/6.5.1
see CERT-C section DCL31-C http://rvdoc.org/CERT-C/DCL31-C