[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.