При компиляции файла, содержащего open("FILENAME", O_RDONLY);
без -O2
, флаг все в порядке. Но когда -O2
включен я получаю:gcc -O2 vs. without вызывает ошибку
/usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function ‘open’:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:44:7: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:45:26: error: call to ‘__open_too_many_args’ declared with attribute error: open can be called either with 2 or 3 arguments, not more
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:42:1: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:60:3: error: invalid use of ‘__builtin_va_arg_pack()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function ‘open64’:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:76:7: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:77:28: error: call to ‘__open64_too_many_args’ declared with attribute error: open64 can be called either with 2 or 3 arguments, not more
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:74:1: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:92:3: error: invalid use of ‘__builtin_va_arg_pack()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function ‘openat’:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:120:7: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:121:28: error: call to ‘__openat_too_many_args’ declared with attribute error: openat can be called either with 3 or 4 arguments, not more
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:118:1: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:136:3: error: invalid use of ‘__builtin_va_arg_pack()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h: In function ‘openat64’:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:154:7: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:155:30: error: call to ‘__openat64_too_many_args’ declared with attribute error: openat64 can be called either with 3 or 4 arguments, not more
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:152:1: error: invalid use of ‘__builtin_va_arg_pack_len()’
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:170:3: error: invalid use of ‘__builtin_va_arg_pack()’
Где может быть проблема? Это смешанный проект C/C++
, но это часть C
. GCC 4.6.1, ядро 3.0.0
Edit: Оказывается, что commeting из тех линии дает еще один «тип» ошибки как:
/usr/include/x86_64-linux-gnu/bits/stdio2.h: In function ‘sprintf’:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:34:3: error: invalid use of ‘__builtin_va_arg_pack()’
Вы можете предоставить минимальный, но полный пример кода, который вызывает эту ошибку? – luiscubal
Странно, вы уверены, что это исходит из этой строки? Вы включаете все необходимое? (для open и O_RDONLY) – BenjaminB
Так вы называете 'g ++' или 'gcc'? – 0xC0000022L