Add documentation and tests for _Pragma.

This commit is contained in:
Stephen Heumann 2022-10-29 16:00:38 -05:00
parent e5428b21d2
commit 913052fe7c
3 changed files with 38 additions and 0 deletions

View File

@ -22,6 +22,7 @@
{1} c99math.c
{1} c99fpcmp.c
{1} c99tgmath.c
{1} c99pragma.c
{1} c11generic.c
{1} c11align.c
{1} c11noret.c

View File

@ -0,0 +1,23 @@
/*
* Test _Pragma preprocessing operator (C99).
*/
#include <stdio.h>
#pragma optimize -1
#pragma debug -1
_Pragma("debug 0")
#define p(x) _Pragma(#x)
#define opt(x) p(optimize x)
void f(int n, ...) {
}
opt(1+2)
int _Pragma("")main(_Pragma("*#^abcdefg foo bar baz")void) {
f(123, 456, 789);
printf _Pragma("unrecognized")("Passed Conformance Test c99pragma\n");
}

View File

@ -583,6 +583,20 @@ Members of anonymous structures or unions (including nested ones) may be accesse
The _Thread_local storage-class specifier may be used together with static or extern. This has the normal effect of the other storage-class specifier while also indicating that the variable has thread-local storage. For declarations within a function, _Thread_local must be used together with static or extern.
29. (C99) ORCA/C now supports the _Pragma preprocessing operator. A token sequence of the form
_Pragma ( string-literal )
is processed as if the contents of the string literal were the operands of a #pragma preprocessing directive. For example,
_Pragma("optimize 1")
is equivalent to the directive
#pragma optimize 1
The _Pragma("...") token sequence may be formed using preprocessor macros.
Multi-Character Character Constants
-----------------------------------