aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2018-11-12 21:06:30 -0500
committerSandra Loosemore <sandra@gcc.gnu.org>2018-11-12 21:06:30 -0500
commit37e5eefb92cdc6a7a320eecb5b81bcb3e526c35f (patch)
tree312ba863e6c3484cc31c704c8093a93e1c310f57 /gcc
parent85177e1075ad8065f1e19cd822832cdf73a1b6ed (diff)
downloadgcc-37e5eefb92cdc6a7a320eecb5b81bcb3e526c35f.zip
gcc-37e5eefb92cdc6a7a320eecb5b81bcb3e526c35f.tar.gz
gcc-37e5eefb92cdc6a7a320eecb5b81bcb3e526c35f.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/doc/cpp.texi15
-rw-r--r--gcc/doc/extend.texi4
3 files changed, 23 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 16ecf33..17f8d31 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index cb5d5bd..25518ee 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -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
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 04a069f..5b180e7 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -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::