c-semantics icon indicating copy to clipboard operation
c-semantics copied to clipboard

kcc cannot recognize PATH_MAX

Open husbd opened this issue 6 years ago • 1 comments

As title. KCC version:

kcc: version 1.0 GNU-compatible

Build number: 86da32c-1543374821277
Current profile: x86_64-linux-gcc-glibc
Installed profiles: x86_64-linux-gcc-glibc-gnuc
	            x86_64-linux-gcc-glibc-gnuc-reverse-eval-order
	            x86_64-linux-gcc-glibc-reverse-eval-order
	            x86_64-linux-gcc-glibc
	            x86-gcc-limited-libc
Default profile: x86_64-linux-gcc-glibc

This problem can be minimized as

// filename: test.c
#include <limits.h>
#include <stdio.h>

int main(){
    int i;
    i = PATH_MAX;
    printf("PATH_MAX value: %d", i);
    return 0;
}

Compile:

kcc test.c

You will get error:

test.c: In function ‘main’:
test.c:7:9: error: ‘PATH_MAX’ undeclared (first use in this function)
     i = PATH_MAX;
         ^
test.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
Translation failed (kcc_config dumped). To repeat, run this command in directory Desktop:
kcc -d test.c

husbd avatar Nov 29 '18 20:11 husbd

This should work with kcc -std=gnu11 test.c (note that it also fails with gcc -std=c11, which is basically the default behavior of kcc).

chathhorn avatar Nov 29 '18 22:11 chathhorn