STD C header include in CINT causes strange errors

Dear all,

I am using root 5.28/00.
When trying to include a standard C header file inside a CINT session, it complains about a “syntax error” in the header itself; namely:

root [0] #include <wordexp.h> Warning: Automatic variable WRDE_DOOFFS is allocated /usr/include/wordexp.h:31: Warning: Automatic variable WRDE_APPEND is allocated /usr/include/wordexp.h:32: Warning: Automatic variable WRDE_NOCMD is allocated /usr/include/wordexp.h:33: Warning: Automatic variable WRDE_REUSE is allocated /usr/include/wordexp.h:34: Warning: Automatic variable WRDE_SHOWERR is allocated /usr/include/wordexp.h:35: Warning: Automatic variable WRDE_UNDEF is allocated /usr/include/wordexp.h:36: Syntax Error: __WRDE_FLAGS=(WRDE_DOOFFS|WRDE_APPEND|WRDE_NOCMD|WRDE_REUSE|WRDE_SHOWERR|WRDE_UNDEF) /usr/include/wordexp.h:39: *** Interpreter error recovered ***

The allocated variables are part of an enum declaration in the header, wordexp.h, usually under /lib/include. The same if I declare the header extern “C”.
It is also very strange that copying the enum declaration line by line in the CINT, it does not complain at all:

root [0] enum { end with ';', '@':abort > WRDE_DOOFFS = (1 << 0), end with ';', '@':abort > WRDE_APPEND = (1 << 1), end with ';', '@':abort > WRDE_NOCMD = (1 << 2), end with ';', '@':abort > WRDE_REUSE = (1 << 3), end with ';', '@':abort > WRDE_SHOWERR = (1 << 4), end with ';', '@':abort > WRDE_UNDEF = (1 << 5), end with ';', '@':abort > __WRDE_FLAGS = (WRDE_DOOFFS | WRDE_APPEND | WRDE_NOCMD | WRDE_REUSE | WRDE_SHOWERR | WRDE_UNDEF) end with ';', '@':abort > }; root [1] root [1] root [1] root [1] WRDE_NOCMD (const enum )4

The inclusion of other standard C or C++ headers does not cause any error: #include , #include
The error disappears when compiling, but it would be nice if I could use the CINT.
Any suggestions about this?

Thank you in advance.
federico

Hi,

CINT isn’t able to parse all C / C++ constructs; this might be a problem with the preprocessor implementation in CINT. I would suggest that you don’t expose this header to CINT, and instead provide a more basic implementation that contains only those parts that you actually need. You can redirect CINT using

#ifdef __CINT__
#include "wordexp_CINT.h"
#else
#include "wordexp.h"
#endif

Cheers, Axel.