[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C99 includes called from C++ files in groff-1.18.1
From: |
Martin MOKREJŠ |
Subject: |
C99 includes called from C++ files in groff-1.18.1 |
Date: |
Wed, 5 Feb 2003 12:28:51 +0100 (CET) |
Hi,
I think I found a reason why I cannot compile groff-1.18.1 on Tru64Unix
5.1A with native cc/cxx. I've upgraded to latest version of both compiler,
i.e. 6.5-033 but still no luck.
cxx -I. -I/usr/local/scratch/groff-1.18.1/src/libs/libgroff
-I/scratch/groff-1.18.1/src/include -I/scratch/groff-1.18.1/src/include
-DHAVE_CONFIG_H -O2 -arch ev56 -I/software/@sys/usr/include
-I/usr/local/include -I/usr/local/openssl/include -c tmpname.cc
cxx: Error: tmpname.cc, line 52: could not open source file "stdint.h"
# include <stdint.h>
--------------------^
cxx: Info: 1 error detected in the compilation of "tmpname.cc".
make[2]: *** [tmpname.o] Error 1
make[2]: Leaving directory `/usr/local/scratch/groff-1.18.1/src/libs/libgroff'
The manpage for cxx sayis nothing about C99 support, although cc does.
Is really cxx needed to compile the file? ;-) Please Cc: me in replies.
Quoted from release notes for the cc compiler:
6. Header Files
The Compaq C kit delivers new header files into /usr/include.dtk. These
include header files that define the parallel decomposition APIs (omp.h,
mpc.h), new C99 header files (e.g. stdbool.h), and "supplemental" header
files that contain new C99 declarations (e.g. stdio.h).
6.1 New C99 library functions
The Compac C compiler kit ships system header files that declare new
ANSI/ISO C99 library names such as round, roundf, and roundl (math.h).
The C99 header files install into /usr/include.dtk. This directory is
added to the compiler's #include search path automatically by the cc
driver so that the header files will be read during "normal" compiles.
The header files declare ALL of the new C99 names even though many of
those functions do not yet exist in the libraries of shipping versions
of Tru64 UNIX. The names are reserved by the C99 Standard and the
library functions will become available in future versions of the OS.
The header files are conditionalized so that the new C99 names ARE
available in the default compilation mode (-std, relaxed ANSI). This
may cause compilation problems, however, since the new names may
conflict with user-declared program names. If such problems arise,
users might consider
o renaming the conflicting identifier(s) in their code. While
sometimes difficult, this is clearly the preferred option. It is
consistent with the emerging C99 Standard and leaves the new C99
API fully available.
o adding -U__STDC_VERSION__ to the command-line or using -D to set
it to something less than 199901. This turns off just those
features introduced by C99.
o defining an explicit library conformance macro on the
command-line, i.e. -D_ANSI_C_SOURCE or -D_XOPEN_SOURCE. This
turns off more features than just those introduced by C99 and so
is not recommended for programs that rely on Tru64 UNIX
extensions. See the standards(5) man page for details.
o compiling in a language mode that does not provide these new C99
names. Such modes include -std0 (K&R), -std1 (strict ANSI C89),
and -vaxc.
To compile in a mode that does not support C99 language features
(-std0, -std1, and -vaxc) but still get declarations for the new C99
library functions, users might consider
o adding -D__STDC_VERSION__=199901 to the command-line.
6.2 #include_next preprocessing directive
Compaq C implements the gcc #include_next directive.
#include_next looks like and works like #include. The only difference
is that it uses a slightly different algorithm for finding the
specified file.
To implement #include searching, the compiler constructs an ordered
list of directories to search:
1) directory containing the original source file
2) directories specified by -I command-line switches
3) /usr/include
To find a file, the compiler simply walks this directory search list
(from the top) until it finds the file. The search list can be
modified in two ways:
a) the <> form (as opposed to the "" form) of #include means
don't do #1 (don't search the original source dir)
b) -I (with no argument) means don't do #3 (don't search
/usr/include)
#include_next uses the same search list, it just uses it in a slightly
different way. Instead of starting from the top of the list every
time it searches for a new file, #include_next remembers the directory
where it finds every file. If it finds an #include_next directive in
a file, it begins the search for the new file in the NEXT directory
after that file in the search list. For example, if the search list
looks like this
1) /usr/foo_dir (contains foo.c)
2) /usr/bar_dir (contains foo.h)
3) /usr/include (contains foo.h)
If foo.c contains "#include <foo.h>" the compiler will find
/usr/bar_dir/foo.h.
If /usr/bar_dir/foo.h contains "#include <foo.h>" the compiler
will find /usr/bar_dir/bar.h, the same file. If that file isn't
properly guarded, this will lead to infinite recursive inclusion.
If /usr/bar_dir/foo.h contains "#include_next <foo.h>" the
compiler will find /usr/include/bar.h, a different file.
This new directive allows users to create new header files that
"supplement" existing header files. Users might, for instance, create
a new stdio.h file that adds more declarations to the existing file.
The new file would then contain "#include_next <stdio.h>". Any source
file with "#include <stdio.h>" would then, given the correct -I
command-line switch, get both the new declarations from the
supplemental file and also the full contents of the original system
header file.
The Compaq C compiler kit uses exactly this technique for adding new
C99 declarations to the standard system header files such as stdio.h.
o the supplemental header files are contained in /usr/include.dtk
o the cc driver adds -I/usr/include.dtk to the default command-line
o the supplemental files contain the new C99 declarations and also
#include_next directives to get the full contents of their
counterpart files from /usr/include
--
Martin Mokrejs <address@hidden>, <address@hidden>
PGP5.0i key is at http://www.natur.cuni.cz/~mmokrejs
MIPS / Institute for Bioinformatics <http://mips.gsf.de>
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1, D-85764 Neuherberg, Germany
tel.: +49-89-3187 3683 , fax: +49-89-3187 3585
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- C99 includes called from C++ files in groff-1.18.1,
Martin MOKREJŠ <=