Commit 37e5eefb by Sandra Loosemore Committed by Sandra Loosemore

re PR preprocessor/47823 (#pragma once is documented in a weird spot)

2018-11-12  Sandra Loosemore  <sandra@codesourcery.com>

	PR preprocessor/47823

	gcc/
	* doc/cpp.texi (Alternatives to Wrapper #ifndef): Move #pragma once
	documentation to...
	(Pragmas): ...here.  
	* doc/extend.texi (Pragmas): Note additional pragmas documented
	in the CPP manual.

From-SVN: r266043
parent 85177e10
2018-11-12 Sandra Loosemore <sandra@codesourcery.com>
PR preprocessor/47823
* doc/cpp.texi (Alternatives to Wrapper #ifndef): Move #pragma once
documentation to...
(Pragmas): ...here.
* doc/extend.texi (Pragmas): Note additional pragmas documented
in the CPP manual.
2018-11-13 Kugan Vivekanandarajah <kuganv@linaro.org>
PR middle-end/86677
......@@ -958,10 +958,7 @@ prevent the file from ever being read again, by either @samp{#import} or
@samp{#import} and @samp{#include} to refer to the same header file.
Another way to prevent a header file from being included more than once
is with the @samp{#pragma once} directive. If @samp{#pragma once} is
seen when scanning a header file, that file will never be read again, no
matter what.
is with the @samp{#pragma once} directive (@pxref{Pragmas}).
@samp{#pragma once} does not have the problems that @samp{#import} does,
but it is not recognized by all preprocessors, so you cannot rely on it
in a portable program.
......@@ -3550,12 +3547,14 @@ idea of the directory containing the current file.
@node Pragmas
@chapter Pragmas
@cindex pragma directive
The @samp{#pragma} directive is the method specified by the C standard
for providing additional information to the compiler, beyond what is
conveyed in the language itself. The forms of this directive
(commonly known as @dfn{pragmas}) specified by C standard are prefixed with
@code{STDC}. A C compiler is free to attach any meaning it likes to other
pragmas. All GNU-defined, supported pragmas have been given a
pragmas. Most GNU-defined, supported pragmas have been given a
@code{GCC} prefix.
@cindex @code{_Pragma}
......@@ -3658,6 +3657,12 @@ contained in the pragma must be a single string literal. Similarly,
the @samp{#warning} and @samp{#error} directives, these pragmas can be
embedded in preprocessor macros using @samp{_Pragma}.
@item #pragma once
If @code{#pragma once} is seen when scanning a header file, that
file will never be read again, no matter what. It is a less-portable
alternative to using @samp{#ifndef} to guard the contents of header files
against multiple inclusions.
@end ftable
@node Other Directives
......
......@@ -22064,6 +22064,10 @@ code originally written for other compilers. Note that in general
we do not recommend the use of pragmas; @xref{Function Attributes},
for further explanation.
The GNU C preprocessor recognizes several pragmas in addition to the
compiler pragmas documented here. Refer to the CPP manual for more
information.
@menu
* AArch64 Pragmas::
* ARM Pragmas::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment