{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Suppose you specify ‘-i/usr/local/include ’ and

Info iconThis preview shows pages 16–18. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Suppose you specify ‘-I /usr/local/include ’, and the list of directories to search also includes ‘ /usr/include ’; and suppose both directories contain ‘ signal.h ’. Ordinary #include <signal.h> finds the file under ‘ /usr/local/include ’. If that file contains #include_next <signal.h> , it starts searching after that directory, and finds the file in ‘ /usr/include ’. ‘ #include_next ’ does not distinguish between < file > and " file " inclusion, nor does it check that the file you specify has the same name as the current file. It simply looks for the file named, starting with the directory in the search path after the one where the current file was found. Chapter 3: Macros 13 The use of ‘ #include_next ’ can lead to great confusion. We recommend it be used only when there is no other alternative. In particular, it should not be used in the headers belonging to a specific program; it should be used only to make global corrections along the lines of fixincludes . 2.8 System Headers The header files declaring interfaces to the operating system and runtime libraries often can- not be written in strictly conforming C. Therefore, GCC gives code found in system headers special treatment. All warnings, other than those generated by ‘ #warning ’ (see Chapter 5 [Diagnostics], page 43 ), are suppressed while GCC is processing a system header. Macros defined in a system header are immune to a few warnings wherever they are expanded. This immunity is granted on an ad-hoc basis, when we find that a warning generates lots of false positives because of code in macros defined in system headers. Normally, only the headers found in specific directories are considered system headers. These directories are determined when GCC is compiled. There are, however, two ways to make normal headers into system headers. The ‘-isystem ’ command line option adds its argument to the list of directories to search for headers, just like ‘-I ’. Any headers found in that directory will be considered system headers. All directories named by ‘-isystem ’ are searched after all directories named by ‘-I ’, no matter what their order was on the command line. If the same directory is named by both ‘-I ’ and ‘-isystem ’, the ‘-I ’ option is ignored. GCC provides an informative message when this occurs if ‘-v ’ is used. There is also a directive, #pragma GCC system_header , which tells GCC to consider the rest of the current include file a system header, no matter where it was found. Code that comes before the ‘ #pragma ’ in the file will not be affected. #pragma GCC system_header has no effect in the primary source file. On very old systems, some of the pre-defined system header directories get even more special treatment. GNU C ++ considers code in headers found in those directories to be surrounded by an extern "C" block. There is no way to request this behavior with a ‘ #pragma ’, or from the command line....
View Full Document

{[ snackBarMessage ]}

Page16 / 83

Suppose you specify ‘-I/usr/local/include ’ and the...

This preview shows document pages 16 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon bookmark
Ask a homework question - tutors are online