[cfe-dev] Disable Header Search Option and errors related to it

Satya Prakash Prasad satyaprakash.prasad at gmail.com
Tue Jul 10 00:12:32 PDT 2012


My issue is that when my program tries to keep including header files
it gives issues which I cannot resolve. Like as mentioned below:

    HeaderSearchOptions &HS = TheCompInst.getHeaderSearchOpts();
    HS.AddPath("/usr/include/c++/4.1.2/backward/", frontend::Angled,
true, false, true);
    HS.AddPath("/usr/include/c++/4.1.2/", frontend::Angled, true, false, true);
    HS.AddPath("/usr/include/c++/", frontend::Angled, true, false, true);
    HS.AddPath("/usr/include/", frontend::Angled, true, false, true);
    HS.AddPath("/usr/include/linux/", frontend::Angled, true, false, true);
    HS.AddPath("/x/local/satprasad/gcc-4.1.2/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include/",
frontend::Angled, true, false, true);
    HS.AddPath("/usr/include/c++/4.1.1/", frontend::Angled, true, false, true);
    HS.AddPath("/usr/include/c++/4.1.1/x86_64-redhat-linux/",
frontend::Angled, true, false, true);


When I run the program to parse a .cpp file which has multiple
#include directive I get below error:
……………………………………………………………………………………………………………
/usr/include/c++/4.1.2/limits:1013:16: error: use of undeclared
identifier '__builtin_huge_valf'
      { return __builtin_huge_valf (); }
               ^
/usr/include/c++/4.1.2/limits:1015:16: error: use of undeclared
identifier '__builtin_nanf'
      { return __builtin_nanf (""); }
               ^
/usr/include/c++/4.1.2/limits:1017:16: error: use of undeclared
identifier '__builtin_nansf'
      { return __builtin_nansf (""); }
               ^
/usr/include/c++/4.1.2/limits:1070:16: error: use of undeclared
identifier '__builtin_huge_val'
      { return __builtin_huge_val(); }
               ^
/usr/include/c++/4.1.2/limits:1072:16: error: use of undeclared
identifier '__builtin_nan'
      { return __builtin_nan (""); }
               ^
/usr/include/c++/4.1.2/limits:1074:16: error: use of undeclared
identifier '__builtin_nans'
      { return __builtin_nans (""); }
               ^
/usr/include/c++/4.1.2/limits:1128:16: error: use of undeclared
identifier '__builtin_huge_vall'
      { return __builtin_huge_vall (); }
               ^
/usr/include/c++/4.1.2/limits:1130:16: error: use of undeclared
identifier '__builtin_nanl'
      { return __builtin_nanl (""); }
               ^
/usr/include/c++/4.1.2/limits:1132:16: error: use of undeclared
identifier '__builtin_nansl'
      { return __builtin_nansl (""); }
               ^
Stack dump:
0.      /usr/include/c++/4.1.2/memory:61:1: current parser token 'namespace'
Segmentation fault

After rectifying a few I still get many of those.

Since my program is to process statements of an input .cpp file - i am
not in need to really include header files and do validation a)
whether it is there or not in system path b)if all declarations are
there

So I require my code to be made such that it should skip validating
the includes and process the file. When I comment the HeaderSearch
Option I get :

W.cpp:1:10: fatal error: 'system/Tools.h' file not found
#include "system/Tools.h"
             ^
The program runs via a command line

rewrite test.cpp

And the program logic breaks.

Please advise how can I overrule these header search options?

Thanks in advance.

Regards,
Prakash




More information about the cfe-dev mailing list