[ 
https://issues.apache.org/jira/browse/STDCXX-377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485371
 ] 

Martin Sebor commented on STDCXX-377:
-------------------------------------

One important detail I missed is that the problematic declarations in the libc 
headers in /usr/include (such as memchr, strchr, etc.) are only disabled when 
-AA is used and enabled when -Aa is specified, which prevents us from using -AA 
which the documentation suggests is incompatible with -Aa. it really isn't, but 
it's hard to tell given all the cautionary statements. See for example the aCC 
3.70 online manual:
http://www.docs.hp.com/en/7762/5991-4874/options.htm#opt-capsAa
http://www.docs.hp.com/en/7762/5991-4874/options.htm#opt-AA

> [HP aCC +nostl] libc headers not in preprocessor search path
> ------------------------------------------------------------
>
>                 Key: STDCXX-377
>                 URL: https://issues.apache.org/jira/browse/STDCXX-377
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: External
>         Environment: HP aCC +nostl
>            Reporter: Martin Sebor
>            Priority: Critical
>
> In order to make it possible to link with third party implementations of the 
> C++ Standard Library (such as stdcxx) the HP aCC +nostl option removes 
> -lstd_v2, the HP aCC C++ standard library from the linker line. See 
> http://www.docs.hp.com/en/7762/5991-4874/options.htm#opt+nostl
> The option also removes the directories containing the native C++ Standard 
> Library headers from the compiler command line, presumably so as to prevent 
> collisions between them and those provided by third party implementations of 
> the same.
> However, the option also removes all other -I options from the compiler 
> command line, including /usr/include, making it impossible for the 
> preprocessor to find even libc or system headers. Add -I/usr/include is the 
> only way to deal with it but doing so is typically frowned upon by compiler 
> vendors, including HP. In addition, some of the HP libc headers in 
> /usr/include make heavy use of preprocessor logic to disable the declarations 
> of C functions that C++ replaces with its own, such as memchr() et al, making 
> it even more difficult to use these headers.
> $ cat t.cpp && aCC -AA +nostl -V t.cpp || aCC -AA +nostl -I/usr/include t.cpp
> #include <cstring>
> int main ()
> {
>     memchr ("", 0, 0);
>     strchr ("", 0);
>     strpbrk ("", "");
>     strrchr ("", 0);
>     strstr ("", "");
> }
> aCC: HP ANSI C++ B3910B A.03.73
> Error 112: "t.cpp", line 1 # Include file <cstring> not found.
>     #include <cstring>
>              ^^^^^^^^^
> Error 328: "t.cpp", line 5 # Function 'memchr' has not been defined yet; 
> cannot call.
>         memchr ("", 0, 0);
>         ^^^^^^            
> Error 328: "t.cpp", line 6 # Function 'strchr' has not been defined yet; 
> cannot call.
>         strchr ("", 0);
>         ^^^^^^         
> Error 328: "t.cpp", line 7 # Function 'strpbrk' has not been defined yet; 
> cannot call.
>         strpbrk ("", "");
>         ^^^^^^^          
> Error 328: "t.cpp", line 8 # Function 'strrchr' has not been defined yet; 
> cannot call.
>         strrchr ("", 0);
>         ^^^^^^^         
> Error 328: "t.cpp", line 9 # Function 'strstr' has not been defined yet; 
> cannot call.
>         strstr ("", "");
>         ^^^^^^          
> Error 112: "t.cpp", line 1 # Include file <cstring> not found.
>     #include <cstring>
>              ^^^^^^^^^
> Error 328: "t.cpp", line 5 # Function 'memchr' has not been defined yet; 
> cannot call.
>         memchr ("", 0, 0);
>         ^^^^^^            
> Error 328: "t.cpp", line 6 # Function 'strchr' has not been defined yet; 
> cannot call.
>         strchr ("", 0);
>         ^^^^^^         
> Error 328: "t.cpp", line 7 # Function 'strpbrk' has not been defined yet; 
> cannot call.
>         strpbrk ("", "");
>         ^^^^^^^          
> Error 328: "t.cpp", line 8 # Function 'strrchr' has not been defined yet; 
> cannot call.
>         strrchr ("", 0);
>         ^^^^^^^         
> Error 328: "t.cpp", line 9 # Function 'strstr' has not been defined yet; 
> cannot call.
>         strstr ("", "");
>         ^^^^^^          

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to