eliben / pycparser

:snake: Complete C99 parser in pure Python
Other
3.24k stars 609 forks source link

assertion error on gcc-9 stddef.h #524

Closed kevint324 closed 10 months ago

kevint324 commented 10 months ago

python func_defs.py cnxx.h

john@bjys1094:~/code/proj/install_dir/usr/local/neuware/include$ python func_defs.py cnrt.h
Traceback (most recent call last):
  File "/home/john/code/proj/install_dir/usr/local/neuware/include/func_defs.py", line 45, in <module>
    show_func_defs(filename)
  File "/home/john/code/proj/install_dir/usr/local/neuware/include/func_defs.py", line 32, in show_func_defs
    ast = parse_file(filename, use_cpp=True,
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/__init__.py", line 90, in parse_file
    return parser.parse(text, filename)
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/c_parser.py", line 147, in parse
    return self.cparser.parse(
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/ply/yacc.py", line 331, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/ply/yacc.py", line 1199, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/ply/yacc.py", line 193, in call_errorfunc
    r = errorfunc(token)
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/c_parser.py", line 1931, in p_error
    self._parse_error(
  File "/home/john/anaconda3/envs/proj/lib/python3.9/site-packages/pycparser/plyparser.py", line 67, in _parse_error
    raise ParseError("%s: %s" % (coord, msg))
pycparser.plyparser.ParseError: /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h:416:28: before: __attribute__
405 /* Offset of member MEMBER in a struct of type TYPE. */
406 #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
407 
408 #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
409   || (defined(__cplusplus) && __cplusplus >= 201103L)
410 #ifndef _GCC_MAX_ALIGN_T
411 #define _GCC_MAX_ALIGN_T
412 /* Type whose alignment is supported in every context and is at least
413    as great as that of any standard type not using alignment
414    specifiers.  */
415 typedef struct {
416   long long __max_align_ll __attribute__((__aligned__(__alignof__(long long))));
417   long double __max_align_ld __attribute__((__aligned__(__alignof__(long double))));
418   /* _Float128 is defined as a basic type, so max_align_t must be
419      sufficiently aligned for it.  This code must work in C++, so we                                                                                                                                                                   
420      use __float128 here; that is only available on some
421      architectures, but only on i386 is extra alignment needed for
422      __float128.  */
423 #ifdef __i386__
424   __float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));
425 #endif
426 } max_align_t;
427 #endif
428 #endif /* C11 or C++11.  */
429