1 /* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
2 Copyright (C) 1992-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
22 #include "coretypes.h"
25 #include "stringpool.h"
28 #include "function.h" /* For cfun. FIXME: Does the parser know
29 when it is inside a function, so that
30 we don't have to look at cfun? */
34 #include "langhooks.h"
37 #include "tm_p.h" /* For REGISTER_TARGET_PRAGMAS (why is
38 this not a target hook?). */
41 #include "diagnostic.h"
46 #define GCC_BAD(gmsgid) \
47 do { warning (OPT_Wpragmas, gmsgid); return; } while (0)
48 #define GCC_BAD2(gmsgid, arg) \
49 do { warning (OPT_Wpragmas, gmsgid, arg); return; } while (0)
51 typedef struct GTY(()) align_stack
{
54 struct align_stack
* prev
;
57 static GTY(()) struct align_stack
* alignment_stack
;
59 static void handle_pragma_pack (cpp_reader
*);
61 /* If we have a "global" #pragma pack(<n>) in effect when the first
62 #pragma pack(push,<n>) is encountered, this stores the value of
63 maximum_field_alignment in effect. When the final pop_alignment()
64 happens, we restore the value to this, not to a value of 0 for
65 maximum_field_alignment. Value is in bits. */
66 static int default_alignment
;
67 #define SET_GLOBAL_ALIGNMENT(ALIGN) (maximum_field_alignment = *(alignment_stack == NULL \
68 ? &default_alignment \
69 : &alignment_stack->alignment) = (ALIGN))
71 static void push_alignment (int, tree
);
72 static void pop_alignment (tree
);
74 /* Push an alignment value onto the stack. */
76 push_alignment (int alignment
, tree id
)
78 align_stack
* entry
= ggc_alloc
<align_stack
> ();
80 entry
->alignment
= alignment
;
82 entry
->prev
= alignment_stack
;
84 /* The current value of maximum_field_alignment is not necessarily
85 0 since there may be a #pragma pack(<n>) in effect; remember it
86 so that we can restore it after the final #pragma pop(). */
87 if (alignment_stack
== NULL
)
88 default_alignment
= maximum_field_alignment
;
90 alignment_stack
= entry
;
92 maximum_field_alignment
= alignment
;
95 /* Undo a push of an alignment onto the stack. */
97 pop_alignment (tree id
)
101 if (alignment_stack
== NULL
)
102 GCC_BAD ("#pragma pack (pop) encountered without matching #pragma pack (push)");
104 /* If we got an identifier, strip away everything above the target
105 entry so that the next step will restore the state just below it. */
108 for (entry
= alignment_stack
; entry
; entry
= entry
->prev
)
111 alignment_stack
= entry
;
115 warning (OPT_Wpragmas
, "\
116 #pragma pack(pop, %E) encountered without matching #pragma pack(push, %E)"
120 entry
= alignment_stack
->prev
;
122 maximum_field_alignment
= entry
? entry
->alignment
: default_alignment
;
124 alignment_stack
= entry
;
131 #pragma pack (push, N)
132 #pragma pack (push, ID)
133 #pragma pack (push, ID, N)
135 #pragma pack (pop, ID) */
137 handle_pragma_pack (cpp_reader
* ARG_UNUSED (dummy
))
141 enum cpp_ttype token
;
142 enum { set
, push
, pop
} action
;
144 if (pragma_lex (&x
) != CPP_OPEN_PAREN
)
145 GCC_BAD ("missing %<(%> after %<#pragma pack%> - ignored");
147 token
= pragma_lex (&x
);
148 if (token
== CPP_CLOSE_PAREN
)
151 align
= initial_max_fld_align
;
153 else if (token
== CPP_NUMBER
)
155 if (TREE_CODE (x
) != INTEGER_CST
)
156 GCC_BAD ("invalid constant in %<#pragma pack%> - ignored");
157 align
= TREE_INT_CST_LOW (x
);
159 if (pragma_lex (&x
) != CPP_CLOSE_PAREN
)
160 GCC_BAD ("malformed %<#pragma pack%> - ignored");
162 else if (token
== CPP_NAME
)
164 #define GCC_BAD_ACTION do { if (action != pop) \
165 GCC_BAD ("malformed %<#pragma pack(push[, id][, <n>])%> - ignored"); \
167 GCC_BAD ("malformed %<#pragma pack(pop[, id])%> - ignored"); \
170 const char *op
= IDENTIFIER_POINTER (x
);
171 if (!strcmp (op
, "push"))
173 else if (!strcmp (op
, "pop"))
176 GCC_BAD2 ("unknown action %qE for %<#pragma pack%> - ignored", x
);
178 while ((token
= pragma_lex (&x
)) == CPP_COMMA
)
180 token
= pragma_lex (&x
);
181 if (token
== CPP_NAME
&& id
== 0)
185 else if (token
== CPP_NUMBER
&& action
== push
&& align
== -1)
187 if (TREE_CODE (x
) != INTEGER_CST
)
188 GCC_BAD ("invalid constant in %<#pragma pack%> - ignored");
189 align
= TREE_INT_CST_LOW (x
);
197 if (token
!= CPP_CLOSE_PAREN
)
199 #undef GCC_BAD_ACTION
202 GCC_BAD ("malformed %<#pragma pack%> - ignored");
204 if (pragma_lex (&x
) != CPP_EOF
)
205 warning (OPT_Wpragmas
, "junk at end of %<#pragma pack%>");
207 if (flag_pack_struct
)
208 GCC_BAD ("#pragma pack has no effect with -fpack-struct - ignored");
219 align
*= BITS_PER_UNIT
;
224 align
= maximum_field_alignment
;
228 GCC_BAD2 ("alignment must be a small power of two, not %d", align
);
233 case set
: SET_GLOBAL_ALIGNMENT (align
); break;
234 case push
: push_alignment (align
, id
); break;
235 case pop
: pop_alignment (id
); break;
239 typedef struct GTY(()) pending_weak_d
246 static GTY(()) vec
<pending_weak
, va_gc
> *pending_weaks
;
248 static void apply_pragma_weak (tree
, tree
);
249 static void handle_pragma_weak (cpp_reader
*);
252 apply_pragma_weak (tree decl
, tree value
)
256 value
= build_string (IDENTIFIER_LENGTH (value
),
257 IDENTIFIER_POINTER (value
));
258 decl_attributes (&decl
, build_tree_list (get_identifier ("alias"),
259 build_tree_list (NULL
, value
)),
263 if (SUPPORTS_WEAK
&& DECL_EXTERNAL (decl
) && TREE_USED (decl
)
264 && !DECL_WEAK (decl
) /* Don't complain about a redundant #pragma. */
265 && DECL_ASSEMBLER_NAME_SET_P (decl
)
266 && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl
)))
267 warning (OPT_Wpragmas
, "applying #pragma weak %q+D after first use "
268 "results in unspecified behavior", decl
);
274 maybe_apply_pragma_weak (tree decl
)
280 /* Avoid asking for DECL_ASSEMBLER_NAME when it's not needed. */
282 /* No weak symbols pending, take the short-cut. */
283 if (vec_safe_is_empty (pending_weaks
))
285 /* If it's not visible outside this file, it doesn't matter whether
287 if (!DECL_EXTERNAL (decl
) && !TREE_PUBLIC (decl
))
289 /* If it's not a function or a variable, it can't be weak.
290 FIXME: what kinds of things are visible outside this file but
291 aren't functions or variables? Should this be an assert instead? */
292 if (TREE_CODE (decl
) != FUNCTION_DECL
&& TREE_CODE (decl
) != VAR_DECL
)
295 if (DECL_ASSEMBLER_NAME_SET_P (decl
))
296 id
= DECL_ASSEMBLER_NAME (decl
);
299 id
= DECL_ASSEMBLER_NAME (decl
);
300 SET_DECL_ASSEMBLER_NAME (decl
, NULL_TREE
);
303 FOR_EACH_VEC_ELT (*pending_weaks
, i
, pe
)
306 apply_pragma_weak (decl
, pe
->value
);
307 pending_weaks
->unordered_remove (i
);
312 /* Process all "#pragma weak A = B" directives where we have not seen
315 maybe_apply_pending_pragma_weaks (void)
317 tree alias_id
, id
, decl
;
322 if (vec_safe_is_empty (pending_weaks
))
325 FOR_EACH_VEC_ELT (*pending_weaks
, i
, pe
)
333 target
= symtab_node::get_for_asmname (id
);
334 decl
= build_decl (UNKNOWN_LOCATION
,
335 target
? TREE_CODE (target
->decl
) : FUNCTION_DECL
,
336 alias_id
, default_function_type
);
338 DECL_ARTIFICIAL (decl
) = 1;
339 TREE_PUBLIC (decl
) = 1;
340 DECL_WEAK (decl
) = 1;
341 if (TREE_CODE (decl
) == VAR_DECL
)
342 TREE_STATIC (decl
) = 1;
345 error ("%q+D aliased to undefined symbol %qE",
350 assemble_alias (decl
, id
);
354 /* #pragma weak name [= value] */
356 handle_pragma_weak (cpp_reader
* ARG_UNUSED (dummy
))
358 tree name
, value
, x
, decl
;
363 if (pragma_lex (&name
) != CPP_NAME
)
364 GCC_BAD ("malformed #pragma weak, ignored");
368 if (pragma_lex (&value
) != CPP_NAME
)
369 GCC_BAD ("malformed #pragma weak, ignored");
373 warning (OPT_Wpragmas
, "junk at end of %<#pragma weak%>");
375 decl
= identifier_global_value (name
);
376 if (decl
&& DECL_P (decl
))
378 apply_pragma_weak (decl
, value
);
381 DECL_EXTERNAL (decl
) = 0;
382 if (TREE_CODE (decl
) == VAR_DECL
)
383 TREE_STATIC (decl
) = 1;
384 assemble_alias (decl
, value
);
389 pending_weak pe
= {name
, value
};
390 vec_safe_push (pending_weaks
, pe
);
394 /* GCC supports two #pragma directives for renaming the external
395 symbol associated with a declaration (DECL_ASSEMBLER_NAME), for
396 compatibility with the Solaris and VMS system headers. GCC also
397 has its own notation for this, __asm__("name") annotations.
399 Corner cases of these features and their interaction:
401 1) Both pragmas silently apply only to declarations with external
402 linkage (that is, TREE_PUBLIC || DECL_EXTERNAL). Asm labels
403 do not have this restriction.
405 2) In C++, both #pragmas silently apply only to extern "C" declarations.
406 Asm labels do not have this restriction.
408 3) If any of the three ways of changing DECL_ASSEMBLER_NAME is
409 applied to a decl whose DECL_ASSEMBLER_NAME is already set, and the
410 new name is different, a warning issues and the name does not change.
412 4) The "source name" for #pragma redefine_extname is the DECL_NAME,
413 *not* the DECL_ASSEMBLER_NAME.
415 5) If #pragma extern_prefix is in effect and a declaration occurs
416 with an __asm__ name, the #pragma extern_prefix is silently
417 ignored for that declaration.
419 6) If #pragma extern_prefix and #pragma redefine_extname apply to
420 the same declaration, whichever triggered first wins, and a warning
421 is issued. (We would like to have #pragma redefine_extname always
422 win, but it can appear either before or after the declaration, and
423 if it appears afterward, we have no way of knowing whether a modified
424 DECL_ASSEMBLER_NAME is due to #pragma extern_prefix.) */
426 typedef struct GTY(()) pending_redefinition_d
{
429 } pending_redefinition
;
432 static GTY(()) vec
<pending_redefinition
, va_gc
> *pending_redefine_extname
;
434 static void handle_pragma_redefine_extname (cpp_reader
*);
436 /* #pragma redefine_extname oldname newname */
438 handle_pragma_redefine_extname (cpp_reader
* ARG_UNUSED (dummy
))
440 tree oldname
, newname
, decls
, x
;
444 if (pragma_lex (&oldname
) != CPP_NAME
)
445 GCC_BAD ("malformed #pragma redefine_extname, ignored");
446 if (pragma_lex (&newname
) != CPP_NAME
)
447 GCC_BAD ("malformed #pragma redefine_extname, ignored");
450 warning (OPT_Wpragmas
, "junk at end of %<#pragma redefine_extname%>");
453 for (decls
= c_linkage_bindings (oldname
);
457 if (TREE_CODE (decls
) == TREE_LIST
)
459 decl
= TREE_VALUE (decls
);
460 decls
= TREE_CHAIN (decls
);
468 if ((TREE_PUBLIC (decl
) || DECL_EXTERNAL (decl
))
469 && (TREE_CODE (decl
) == FUNCTION_DECL
470 || TREE_CODE (decl
) == VAR_DECL
))
473 if (DECL_ASSEMBLER_NAME_SET_P (decl
))
475 const char *name
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
476 name
= targetm
.strip_name_encoding (name
);
478 if (strcmp (name
, IDENTIFIER_POINTER (newname
)))
479 warning (OPT_Wpragmas
, "#pragma redefine_extname ignored due to "
480 "conflict with previous rename");
483 symtab
->change_decl_assembler_name (decl
, newname
);
488 /* We have to add this to the rename list even if there's already
489 a global value that doesn't meet the above criteria, because in
490 C++ "struct foo {...};" puts "foo" in the current namespace but
491 does *not* conflict with a subsequent declaration of a function
492 or variable foo. See g++.dg/other/pragma-re-2.C. */
493 add_to_renaming_pragma_list (oldname
, newname
);
496 /* This is called from here and from ia64-c.c. */
498 add_to_renaming_pragma_list (tree oldname
, tree newname
)
501 pending_redefinition
*p
;
503 FOR_EACH_VEC_SAFE_ELT (pending_redefine_extname
, ix
, p
)
504 if (oldname
== p
->oldname
)
506 if (p
->newname
!= newname
)
507 warning (OPT_Wpragmas
, "#pragma redefine_extname ignored due to "
508 "conflict with previous #pragma redefine_extname");
512 pending_redefinition e
= {oldname
, newname
};
513 vec_safe_push (pending_redefine_extname
, e
);
516 /* The current prefix set by #pragma extern_prefix. */
517 GTY(()) tree pragma_extern_prefix
;
519 /* variables used to implement #pragma upc semantics */
520 #ifndef UPC_CMODE_STACK_INCREMENT
521 #define UPC_CMODE_STACK_INCREMENT 32
523 static int pragma_upc_permitted
;
524 static int upc_cmode
;
525 static int *upc_cmode_stack
;
526 static int upc_cmode_stack_in_use
;
527 static int upc_cmode_stack_allocated
;
529 static void init_pragma_upc (void);
530 static void handle_pragma_upc (cpp_reader
* ARG_UNUSED (dummy
));
532 /* Initialize the variables used to manage the current UPC consistency
533 mode (strict/relaxed) */
536 init_pragma_upc (void)
538 pragma_upc_permitted
= 0;
540 upc_cmode_stack
= (int *) xcalloc (UPC_CMODE_STACK_INCREMENT
,
542 upc_cmode_stack_allocated
= UPC_CMODE_STACK_INCREMENT
;
543 upc_cmode_stack_in_use
= 0;
548 * #pragma upc relaxed
549 * #pragma upc upc_code
553 handle_pragma_upc (cpp_reader
* ARG_UNUSED (dummy
))
557 enum upc_pragma_op
{p_strict
, p_relaxed
, p_upc_code
,
558 p_c_code
, p_detect_upc
, p_unknown
};
559 enum upc_pragma_op upc_pragma
= p_unknown
;
564 const char *op
= IDENTIFIER_POINTER (x
);
565 if (!strcmp (op
, "strict"))
566 upc_pragma
= p_strict
;
567 else if (!strcmp (op
, "relaxed"))
568 upc_pragma
= p_relaxed
;
569 else if (!strcmp (op
, "upc_code"))
570 upc_pragma
= p_upc_code
;
571 else if (!strcmp (op
, "c_code"))
572 upc_pragma
= p_c_code
;
573 else if (!strcmp (op
, "detect_upc"))
575 const char *detect_op
;
576 upc_pragma
= p_detect_upc
;
579 GCC_BAD ("missing [suspend_insertion|resume_insertion]"
580 " after %<#pragma UPC detect_upc%>");
581 detect_op
= IDENTIFIER_POINTER (x
);
582 if (strcmp (detect_op
, "suspend_insertion") == 0)
584 else if (strcmp (detect_op
, "resume_insertion") == 0)
587 GCC_BAD ("expected [suspend_insertion|resume_insertion]"
588 " after %<#pragma UPC detect_upc%>");
591 GCC_BAD2 ("unknown action '%s' for '#pragma upc' - ignored", op
);
594 warning (OPT_Wpragmas
, "missing parameter after #pragma upc");
598 warning (OPT_Wpragmas
, "junk at end of #pragma upc");
600 if ((upc_pragma
== p_strict
) || (upc_pragma
== p_relaxed
))
602 if (pragma_upc_permitted_p ())
604 int consistency_mode
= (upc_pragma
== p_strict
);
605 set_upc_consistency_mode (consistency_mode
);
608 warning (OPT_Wpragmas
, "#pragma upc not allowed in this context");
610 else if ((upc_pragma
== p_upc_code
) || (upc_pragma
== p_c_code
))
612 flag_upc
= (upc_pragma
== p_upc_code
);
613 lang_hooks
.upc
.toggle_keywords (flag_upc
);
615 else if (upc_pragma
== p_detect_upc
)
617 /* Skip: This is a Berkeley-specific pragma that requires no action. */
621 /* Set the current setting of the UPC consistency mode
622 that is in effect. */
625 set_upc_consistency_mode (int mode
)
630 /* Return the current setting of the UPC consistency mode. */
633 get_upc_consistency_mode (void)
638 /* Called from the parser just after the bracket that opens a compound
639 statement has been parsed. Set the flag that allows the pragma
643 permit_pragma_upc (void)
645 pragma_upc_permitted
= 1;
648 /* Called just before the body of a compound statement is parsed.
649 Clear the flag that allows the pragma. */
652 deny_pragma_upc (void)
654 pragma_upc_permitted
= 0;
657 /* A #pragma upc is permitted either at the outermost scope,
658 or directly after the bracket that opens a compound statement. */
661 pragma_upc_permitted_p (void)
663 return !current_function_decl
|| pragma_upc_permitted
;
666 /* Called at the beginning of every compound statement.
667 Pushes the old value of the current UPC consistency mode
671 push_upc_consistency_mode (void)
673 if (upc_cmode_stack_in_use
== upc_cmode_stack_allocated
)
675 upc_cmode_stack_allocated
+= UPC_CMODE_STACK_INCREMENT
;
676 upc_cmode_stack
= (int *) xrealloc (upc_cmode_stack
,
677 upc_cmode_stack_allocated
* sizeof (int));
679 upc_cmode_stack
[upc_cmode_stack_in_use
++] = upc_cmode
;
682 /* Called at the end of every compound statement.
683 Sets the current consistency mode to the previously saved value. */
686 pop_upc_consistency_mode (void)
688 if (upc_cmode_stack_in_use
<= 0)
690 upc_cmode
= upc_cmode_stack
[--upc_cmode_stack_in_use
];
693 static int pragma_pupc_on
;
694 static void init_pragma_pupc (void);
695 static void handle_pragma_pupc (cpp_reader
*);
697 /* Pragma pupc defaults to being on */
699 init_pragma_pupc (void)
705 get_upc_pupc_mode (void)
707 return pragma_pupc_on
;
711 disable_pupc_mode (void)
713 int old_pupc
= pragma_pupc_on
;
719 set_pupc_mode (int new_pupc
)
721 pragma_pupc_on
= new_pupc
;
729 handle_pragma_pupc (cpp_reader
*dummy ATTRIBUTE_UNUSED
)
736 const char *op
= IDENTIFIER_POINTER (x
);
737 if (!strcmp (op
, "on"))
739 else if (!strcmp (op
, "off"))
742 GCC_BAD2 ("unknown action '%s' for '#pragma pupc' - ignored", op
);
747 warning (OPT_Wpragmas
, "junk at end of #pragma pupc");
750 /* Hook from the front ends to apply the results of one of the preceding
751 pragmas that rename variables. */
754 maybe_apply_renaming_pragma (tree decl
, tree asmname
)
757 pending_redefinition
*p
;
759 /* The renaming pragmas are only applied to declarations with
761 if ((TREE_CODE (decl
) != FUNCTION_DECL
&& TREE_CODE (decl
) != VAR_DECL
)
762 || (!TREE_PUBLIC (decl
) && !DECL_EXTERNAL (decl
))
763 || !has_c_linkage (decl
))
766 /* If the DECL_ASSEMBLER_NAME is already set, it does not change,
767 but we may warn about a rename that conflicts. */
768 if (DECL_ASSEMBLER_NAME_SET_P (decl
))
770 const char *oldname
= IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl
));
771 oldname
= targetm
.strip_name_encoding (oldname
);
773 if (asmname
&& strcmp (TREE_STRING_POINTER (asmname
), oldname
))
774 warning (OPT_Wpragmas
, "asm declaration ignored due to "
775 "conflict with previous rename");
777 /* Take any pending redefine_extname off the list. */
778 FOR_EACH_VEC_SAFE_ELT (pending_redefine_extname
, ix
, p
)
779 if (DECL_NAME (decl
) == p
->oldname
)
781 /* Only warn if there is a conflict. */
782 if (strcmp (IDENTIFIER_POINTER (p
->newname
), oldname
))
783 warning (OPT_Wpragmas
, "#pragma redefine_extname ignored due to "
784 "conflict with previous rename");
786 pending_redefine_extname
->unordered_remove (ix
);
792 /* Find out if we have a pending #pragma redefine_extname. */
793 FOR_EACH_VEC_SAFE_ELT (pending_redefine_extname
, ix
, p
)
794 if (DECL_NAME (decl
) == p
->oldname
)
796 tree newname
= p
->newname
;
797 pending_redefine_extname
->unordered_remove (ix
);
799 /* If we already have an asmname, #pragma redefine_extname is
800 ignored (with a warning if it conflicts). */
803 if (strcmp (TREE_STRING_POINTER (asmname
),
804 IDENTIFIER_POINTER (newname
)) != 0)
805 warning (OPT_Wpragmas
, "#pragma redefine_extname ignored due to "
806 "conflict with __asm__ declaration");
810 /* Otherwise we use what we've got; #pragma extern_prefix is
812 return build_string (IDENTIFIER_LENGTH (newname
),
813 IDENTIFIER_POINTER (newname
));
816 /* If we've got an asmname, #pragma extern_prefix is silently ignored. */
820 /* If #pragma extern_prefix is in effect, apply it. */
821 if (pragma_extern_prefix
)
823 const char *prefix
= TREE_STRING_POINTER (pragma_extern_prefix
);
824 size_t plen
= TREE_STRING_LENGTH (pragma_extern_prefix
) - 1;
826 const char *id
= IDENTIFIER_POINTER (DECL_NAME (decl
));
827 size_t ilen
= IDENTIFIER_LENGTH (DECL_NAME (decl
));
829 char *newname
= (char *) alloca (plen
+ ilen
+ 1);
831 memcpy (newname
, prefix
, plen
);
832 memcpy (newname
+ plen
, id
, ilen
+ 1);
834 return build_string (plen
+ ilen
, newname
);
842 static void handle_pragma_visibility (cpp_reader
*);
844 static vec
<int> visstack
;
846 /* Push the visibility indicated by STR onto the top of the #pragma
847 visibility stack. KIND is 0 for #pragma GCC visibility, 1 for
848 C++ namespace with visibility attribute and 2 for C++ builtin
849 ABI namespace. push_visibility/pop_visibility calls must have
850 matching KIND, it is not allowed to push visibility using one
851 KIND and pop using a different one. */
854 push_visibility (const char *str
, int kind
)
856 visstack
.safe_push (((int) default_visibility
) | (kind
<< 8));
857 if (!strcmp (str
, "default"))
858 default_visibility
= VISIBILITY_DEFAULT
;
859 else if (!strcmp (str
, "internal"))
860 default_visibility
= VISIBILITY_INTERNAL
;
861 else if (!strcmp (str
, "hidden"))
862 default_visibility
= VISIBILITY_HIDDEN
;
863 else if (!strcmp (str
, "protected"))
864 default_visibility
= VISIBILITY_PROTECTED
;
866 GCC_BAD ("#pragma GCC visibility push() must specify default, internal, hidden or protected");
867 visibility_options
.inpragma
= 1;
870 /* Pop a level of the #pragma visibility stack. Return true if
874 pop_visibility (int kind
)
876 if (!visstack
.length ())
878 if ((visstack
.last () >> 8) != kind
)
881 = (enum symbol_visibility
) (visstack
.pop () & 0xff);
882 visibility_options
.inpragma
883 = visstack
.length () != 0;
887 /* Sets the default visibility for symbols to something other than that
888 specified on the command line. */
891 handle_pragma_visibility (cpp_reader
*dummy ATTRIBUTE_UNUSED
)
893 /* Form is #pragma GCC visibility push(hidden)|pop */
895 enum cpp_ttype token
;
896 enum { bad
, push
, pop
} action
= bad
;
898 token
= pragma_lex (&x
);
899 if (token
== CPP_NAME
)
901 const char *op
= IDENTIFIER_POINTER (x
);
902 if (!strcmp (op
, "push"))
904 else if (!strcmp (op
, "pop"))
908 GCC_BAD ("#pragma GCC visibility must be followed by push or pop");
913 if (! pop_visibility (0))
914 GCC_BAD ("no matching push for %<#pragma GCC visibility pop%>");
918 if (pragma_lex (&x
) != CPP_OPEN_PAREN
)
919 GCC_BAD ("missing %<(%> after %<#pragma GCC visibility push%> - ignored");
920 token
= pragma_lex (&x
);
921 if (token
!= CPP_NAME
)
922 GCC_BAD ("malformed #pragma GCC visibility push");
924 push_visibility (IDENTIFIER_POINTER (x
), 0);
925 if (pragma_lex (&x
) != CPP_CLOSE_PAREN
)
926 GCC_BAD ("missing %<(%> after %<#pragma GCC visibility push%> - ignored");
929 if (pragma_lex (&x
) != CPP_EOF
)
930 warning (OPT_Wpragmas
, "junk at end of %<#pragma GCC visibility%>");
934 handle_pragma_diagnostic(cpp_reader
*ARG_UNUSED(dummy
))
936 const char *kind_string
, *option_string
;
937 unsigned int option_index
;
938 enum cpp_ttype token
;
941 struct cl_option_handlers handlers
;
943 token
= pragma_lex (&x
);
944 if (token
!= CPP_NAME
)
945 GCC_BAD ("missing [error|warning|ignored] after %<#pragma GCC diagnostic%>");
946 kind_string
= IDENTIFIER_POINTER (x
);
947 if (strcmp (kind_string
, "error") == 0)
949 else if (strcmp (kind_string
, "warning") == 0)
951 else if (strcmp (kind_string
, "ignored") == 0)
953 else if (strcmp (kind_string
, "push") == 0)
955 diagnostic_push_diagnostics (global_dc
, input_location
);
958 else if (strcmp (kind_string
, "pop") == 0)
960 diagnostic_pop_diagnostics (global_dc
, input_location
);
964 GCC_BAD ("expected [error|warning|ignored|push|pop] after %<#pragma GCC diagnostic%>");
966 token
= pragma_lex (&x
);
967 if (token
!= CPP_STRING
)
968 GCC_BAD ("missing option after %<#pragma GCC diagnostic%> kind");
969 option_string
= TREE_STRING_POINTER (x
);
970 set_default_handlers (&handlers
);
971 for (option_index
= 0; option_index
< cl_options_count
; option_index
++)
972 if (strcmp (cl_options
[option_index
].opt_text
, option_string
) == 0)
974 control_warning_option (option_index
, (int) kind
, kind
!= DK_IGNORED
,
975 input_location
, c_family_lang_mask
, &handlers
,
976 &global_options
, &global_options_set
,
980 GCC_BAD ("unknown option after %<#pragma GCC diagnostic%> kind");
983 /* Parse #pragma GCC target (xxx) to set target specific options. */
985 handle_pragma_target(cpp_reader
*ARG_UNUSED(dummy
))
987 enum cpp_ttype token
;
989 bool close_paren_needed_p
= false;
993 error ("#pragma GCC option is not allowed inside functions");
997 token
= pragma_lex (&x
);
998 if (token
== CPP_OPEN_PAREN
)
1000 close_paren_needed_p
= true;
1001 token
= pragma_lex (&x
);
1004 if (token
!= CPP_STRING
)
1006 GCC_BAD ("%<#pragma GCC option%> is not a string");
1010 /* Strings are user options. */
1013 tree args
= NULL_TREE
;
1017 /* Build up the strings now as a tree linked list. Skip empty
1019 if (TREE_STRING_LENGTH (x
) > 0)
1020 args
= tree_cons (NULL_TREE
, x
, args
);
1022 token
= pragma_lex (&x
);
1023 while (token
== CPP_COMMA
)
1024 token
= pragma_lex (&x
);
1026 while (token
== CPP_STRING
);
1028 if (close_paren_needed_p
)
1030 if (token
== CPP_CLOSE_PAREN
)
1031 token
= pragma_lex (&x
);
1033 GCC_BAD ("%<#pragma GCC target (string [,string]...)%> does "
1034 "not have a final %<)%>");
1037 if (token
!= CPP_EOF
)
1039 error ("#pragma GCC target string... is badly formed");
1043 /* put arguments in the order the user typed them. */
1044 args
= nreverse (args
);
1046 if (targetm
.target_option
.pragma_parse (args
, NULL_TREE
))
1047 current_target_pragma
= args
;
1051 /* Handle #pragma GCC optimize to set optimization options. */
1053 handle_pragma_optimize (cpp_reader
*ARG_UNUSED(dummy
))
1055 enum cpp_ttype token
;
1057 bool close_paren_needed_p
= false;
1058 tree optimization_previous_node
= optimization_current_node
;
1062 error ("#pragma GCC optimize is not allowed inside functions");
1066 token
= pragma_lex (&x
);
1067 if (token
== CPP_OPEN_PAREN
)
1069 close_paren_needed_p
= true;
1070 token
= pragma_lex (&x
);
1073 if (token
!= CPP_STRING
&& token
!= CPP_NUMBER
)
1075 GCC_BAD ("%<#pragma GCC optimize%> is not a string or number");
1079 /* Strings/numbers are user options. */
1082 tree args
= NULL_TREE
;
1086 /* Build up the numbers/strings now as a list. */
1087 if (token
!= CPP_STRING
|| TREE_STRING_LENGTH (x
) > 0)
1088 args
= tree_cons (NULL_TREE
, x
, args
);
1090 token
= pragma_lex (&x
);
1091 while (token
== CPP_COMMA
)
1092 token
= pragma_lex (&x
);
1094 while (token
== CPP_STRING
|| token
== CPP_NUMBER
);
1096 if (close_paren_needed_p
)
1098 if (token
== CPP_CLOSE_PAREN
)
1099 token
= pragma_lex (&x
);
1101 GCC_BAD ("%<#pragma GCC optimize (string [,string]...)%> does "
1102 "not have a final %<)%>");
1105 if (token
!= CPP_EOF
)
1107 error ("#pragma GCC optimize string... is badly formed");
1111 /* put arguments in the order the user typed them. */
1112 args
= nreverse (args
);
1114 parse_optimize_options (args
, false);
1115 current_optimize_pragma
= chainon (current_optimize_pragma
, args
);
1116 optimization_current_node
= build_optimization_node (&global_options
);
1117 c_cpp_builtins_optimize_pragma (parse_in
,
1118 optimization_previous_node
,
1119 optimization_current_node
);
1123 /* Stack of the #pragma GCC options created with #pragma GCC push_option. Save
1124 both the binary representation of the options and the TREE_LIST of
1125 strings that will be added to the function's attribute list. */
1126 typedef struct GTY(()) opt_stack
{
1127 struct opt_stack
*prev
;
1129 tree target_strings
;
1130 tree optimize_binary
;
1131 tree optimize_strings
;
1134 static GTY(()) struct opt_stack
* options_stack
;
1136 /* Handle #pragma GCC push_options to save the current target and optimization
1140 handle_pragma_push_options (cpp_reader
*ARG_UNUSED(dummy
))
1142 enum cpp_ttype token
;
1145 token
= pragma_lex (&x
);
1146 if (token
!= CPP_EOF
)
1148 warning (OPT_Wpragmas
, "junk at end of %<#pragma push_options%>");
1152 opt_stack
*p
= ggc_alloc
<opt_stack
> ();
1153 p
->prev
= options_stack
;
1156 /* Save optimization and target flags in binary format. */
1157 p
->optimize_binary
= build_optimization_node (&global_options
);
1158 p
->target_binary
= build_target_option_node (&global_options
);
1160 /* Save optimization and target flags in string list format. */
1161 p
->optimize_strings
= copy_list (current_optimize_pragma
);
1162 p
->target_strings
= copy_list (current_target_pragma
);
1165 /* Handle #pragma GCC pop_options to restore the current target and
1166 optimization options from a previous push_options. */
1169 handle_pragma_pop_options (cpp_reader
*ARG_UNUSED(dummy
))
1171 enum cpp_ttype token
;
1175 token
= pragma_lex (&x
);
1176 if (token
!= CPP_EOF
)
1178 warning (OPT_Wpragmas
, "junk at end of %<#pragma pop_options%>");
1182 if (! options_stack
)
1184 warning (OPT_Wpragmas
,
1185 "%<#pragma GCC pop_options%> without a corresponding "
1186 "%<#pragma GCC push_options%>");
1191 options_stack
= p
->prev
;
1193 if (p
->target_binary
!= target_option_current_node
)
1195 (void) targetm
.target_option
.pragma_parse (NULL_TREE
, p
->target_binary
);
1196 target_option_current_node
= p
->target_binary
;
1199 if (p
->optimize_binary
!= optimization_current_node
)
1201 tree old_optimize
= optimization_current_node
;
1202 cl_optimization_restore (&global_options
,
1203 TREE_OPTIMIZATION (p
->optimize_binary
));
1204 c_cpp_builtins_optimize_pragma (parse_in
, old_optimize
,
1205 p
->optimize_binary
);
1206 optimization_current_node
= p
->optimize_binary
;
1209 current_target_pragma
= p
->target_strings
;
1210 current_optimize_pragma
= p
->optimize_strings
;
1213 /* Handle #pragma GCC reset_options to restore the current target and
1214 optimization options to the original options used on the command line. */
1217 handle_pragma_reset_options (cpp_reader
*ARG_UNUSED(dummy
))
1219 enum cpp_ttype token
;
1221 tree new_optimize
= optimization_default_node
;
1222 tree new_target
= target_option_default_node
;
1224 token
= pragma_lex (&x
);
1225 if (token
!= CPP_EOF
)
1227 warning (OPT_Wpragmas
, "junk at end of %<#pragma reset_options%>");
1231 if (new_target
!= target_option_current_node
)
1233 (void) targetm
.target_option
.pragma_parse (NULL_TREE
, new_target
);
1234 target_option_current_node
= new_target
;
1237 if (new_optimize
!= optimization_current_node
)
1239 tree old_optimize
= optimization_current_node
;
1240 cl_optimization_restore (&global_options
,
1241 TREE_OPTIMIZATION (new_optimize
));
1242 c_cpp_builtins_optimize_pragma (parse_in
, old_optimize
, new_optimize
);
1243 optimization_current_node
= new_optimize
;
1246 current_target_pragma
= NULL_TREE
;
1247 current_optimize_pragma
= NULL_TREE
;
1250 /* Print a plain user-specified message. */
1253 handle_pragma_message (cpp_reader
*ARG_UNUSED(dummy
))
1255 enum cpp_ttype token
;
1256 tree x
, message
= 0;
1258 token
= pragma_lex (&x
);
1259 if (token
== CPP_OPEN_PAREN
)
1261 token
= pragma_lex (&x
);
1262 if (token
== CPP_STRING
)
1265 GCC_BAD ("expected a string after %<#pragma message%>");
1266 if (pragma_lex (&x
) != CPP_CLOSE_PAREN
)
1267 GCC_BAD ("malformed %<#pragma message%>, ignored");
1269 else if (token
== CPP_STRING
)
1272 GCC_BAD ("expected a string after %<#pragma message%>");
1274 gcc_assert (message
);
1276 if (pragma_lex (&x
) != CPP_EOF
)
1277 warning (OPT_Wpragmas
, "junk at end of %<#pragma message%>");
1279 if (TREE_STRING_LENGTH (message
) > 1)
1280 inform (input_location
, "#pragma message: %s", TREE_STRING_POINTER (message
));
1283 /* Mark whether the current location is valid for a STDC pragma. */
1285 static bool valid_location_for_stdc_pragma
;
1288 mark_valid_location_for_stdc_pragma (bool flag
)
1290 valid_location_for_stdc_pragma
= flag
;
1293 /* Return true if the current location is valid for a STDC pragma. */
1296 valid_location_for_stdc_pragma_p (void)
1298 return valid_location_for_stdc_pragma
;
1301 enum pragma_switch_t
{ PRAGMA_ON
, PRAGMA_OFF
, PRAGMA_DEFAULT
, PRAGMA_BAD
};
1303 /* A STDC pragma must appear outside of external declarations or
1304 preceding all explicit declarations and statements inside a compound
1305 statement; its behavior is undefined if used in any other context.
1306 It takes a switch of ON, OFF, or DEFAULT. */
1308 static enum pragma_switch_t
1309 handle_stdc_pragma (const char *pname
)
1313 enum pragma_switch_t ret
;
1315 if (!valid_location_for_stdc_pragma_p ())
1317 warning (OPT_Wpragmas
, "invalid location for %<pragma %s%>, ignored",
1322 if (pragma_lex (&t
) != CPP_NAME
)
1324 warning (OPT_Wpragmas
, "malformed %<#pragma %s%>, ignored", pname
);
1328 arg
= IDENTIFIER_POINTER (t
);
1330 if (!strcmp (arg
, "ON"))
1332 else if (!strcmp (arg
, "OFF"))
1334 else if (!strcmp (arg
, "DEFAULT"))
1335 ret
= PRAGMA_DEFAULT
;
1338 warning (OPT_Wpragmas
, "malformed %<#pragma %s%>, ignored", pname
);
1342 if (pragma_lex (&t
) != CPP_EOF
)
1344 warning (OPT_Wpragmas
, "junk at end of %<#pragma %s%>", pname
);
1351 /* #pragma STDC FLOAT_CONST_DECIMAL64 ON
1352 #pragma STDC FLOAT_CONST_DECIMAL64 OFF
1353 #pragma STDC FLOAT_CONST_DECIMAL64 DEFAULT */
1356 handle_pragma_float_const_decimal64 (cpp_reader
*ARG_UNUSED (dummy
))
1358 if (c_dialect_cxx ())
1360 if (warn_unknown_pragmas
> in_system_header_at (input_location
))
1361 warning (OPT_Wunknown_pragmas
,
1362 "%<#pragma STDC FLOAT_CONST_DECIMAL64%> is not supported"
1367 if (!targetm
.decimal_float_supported_p ())
1369 if (warn_unknown_pragmas
> in_system_header_at (input_location
))
1370 warning (OPT_Wunknown_pragmas
,
1371 "%<#pragma STDC FLOAT_CONST_DECIMAL64%> is not supported"
1376 pedwarn (input_location
, OPT_Wpedantic
,
1377 "ISO C does not support %<#pragma STDC FLOAT_CONST_DECIMAL64%>");
1379 switch (handle_stdc_pragma ("STDC FLOAT_CONST_DECIMAL64"))
1382 set_float_const_decimal64 ();
1385 case PRAGMA_DEFAULT
:
1386 clear_float_const_decimal64 ();
1393 /* A vector of registered pragma callbacks, which is never freed. */
1395 static vec
<internal_pragma_handler
> registered_pragmas
;
1404 static vec
<pragma_ns_name
> registered_pp_pragmas
;
1406 struct omp_pragma_def
{ const char *name
; unsigned int id
; };
1407 static const struct omp_pragma_def omp_pragmas
[] = {
1408 { "atomic", PRAGMA_OMP_ATOMIC
},
1409 { "barrier", PRAGMA_OMP_BARRIER
},
1410 { "cancel", PRAGMA_OMP_CANCEL
},
1411 { "cancellation", PRAGMA_OMP_CANCELLATION_POINT
},
1412 { "critical", PRAGMA_OMP_CRITICAL
},
1413 { "end", PRAGMA_OMP_END_DECLARE_TARGET
},
1414 { "flush", PRAGMA_OMP_FLUSH
},
1415 { "master", PRAGMA_OMP_MASTER
},
1416 { "ordered", PRAGMA_OMP_ORDERED
},
1417 { "section", PRAGMA_OMP_SECTION
},
1418 { "sections", PRAGMA_OMP_SECTIONS
},
1419 { "single", PRAGMA_OMP_SINGLE
},
1420 { "task", PRAGMA_OMP_TASK
},
1421 { "taskgroup", PRAGMA_OMP_TASKGROUP
},
1422 { "taskwait", PRAGMA_OMP_TASKWAIT
},
1423 { "taskyield", PRAGMA_OMP_TASKYIELD
},
1424 { "threadprivate", PRAGMA_OMP_THREADPRIVATE
}
1426 static const struct omp_pragma_def omp_pragmas_simd
[] = {
1427 { "declare", PRAGMA_OMP_DECLARE_REDUCTION
},
1428 { "distribute", PRAGMA_OMP_DISTRIBUTE
},
1429 { "for", PRAGMA_OMP_FOR
},
1430 { "parallel", PRAGMA_OMP_PARALLEL
},
1431 { "simd", PRAGMA_OMP_SIMD
},
1432 { "target", PRAGMA_OMP_TARGET
},
1433 { "teams", PRAGMA_OMP_TEAMS
},
1437 c_pp_lookup_pragma (unsigned int id
, const char **space
, const char **name
)
1439 const int n_omp_pragmas
= sizeof (omp_pragmas
) / sizeof (*omp_pragmas
);
1440 const int n_omp_pragmas_simd
= sizeof (omp_pragmas_simd
)
1441 / sizeof (*omp_pragmas
);
1444 for (i
= 0; i
< n_omp_pragmas
; ++i
)
1445 if (omp_pragmas
[i
].id
== id
)
1448 *name
= omp_pragmas
[i
].name
;
1452 for (i
= 0; i
< n_omp_pragmas_simd
; ++i
)
1453 if (omp_pragmas_simd
[i
].id
== id
)
1456 *name
= omp_pragmas_simd
[i
].name
;
1460 if (id
== PRAGMA_CILK_SIMD
)
1467 if (id
>= PRAGMA_FIRST_EXTERNAL
1468 && (id
< PRAGMA_FIRST_EXTERNAL
+ registered_pp_pragmas
.length ()))
1470 *space
= registered_pp_pragmas
[id
- PRAGMA_FIRST_EXTERNAL
].space
;
1471 *name
= registered_pp_pragmas
[id
- PRAGMA_FIRST_EXTERNAL
].name
;
1478 /* Front-end wrappers for pragma registration to avoid dragging
1479 cpplib.h in almost everywhere. */
1482 c_register_pragma_1 (const char *space
, const char *name
,
1483 internal_pragma_handler ihandler
, bool allow_expansion
)
1487 if (flag_preprocess_only
)
1489 pragma_ns_name ns_name
;
1491 if (!allow_expansion
)
1494 ns_name
.space
= space
;
1495 ns_name
.name
= name
;
1496 registered_pp_pragmas
.safe_push (ns_name
);
1497 id
= registered_pp_pragmas
.length ();
1498 id
+= PRAGMA_FIRST_EXTERNAL
- 1;
1502 registered_pragmas
.safe_push (ihandler
);
1503 id
= registered_pragmas
.length ();
1504 id
+= PRAGMA_FIRST_EXTERNAL
- 1;
1506 /* The C++ front end allocates 6 bits in cp_token; the C front end
1507 allocates 7 bits in c_token. At present this is sufficient. */
1508 gcc_assert (id
< 64);
1511 cpp_register_deferred_pragma (parse_in
, space
, name
, id
,
1512 allow_expansion
, false);
1515 /* Register a C pragma handler, using a space and a name. It disallows pragma
1516 expansion (if you want it, use c_register_pragma_with_expansion instead). */
1518 c_register_pragma (const char *space
, const char *name
,
1519 pragma_handler_1arg handler
)
1521 internal_pragma_handler ihandler
;
1523 ihandler
.handler
.handler_1arg
= handler
;
1524 ihandler
.extra_data
= false;
1525 ihandler
.data
= NULL
;
1526 c_register_pragma_1 (space
, name
, ihandler
, false);
1529 /* Register a C pragma handler, using a space and a name, it also carries an
1530 extra data field which can be used by the handler. It disallows pragma
1531 expansion (if you want it, use c_register_pragma_with_expansion_and_data
1534 c_register_pragma_with_data (const char *space
, const char *name
,
1535 pragma_handler_2arg handler
, void * data
)
1537 internal_pragma_handler ihandler
;
1539 ihandler
.handler
.handler_2arg
= handler
;
1540 ihandler
.extra_data
= true;
1541 ihandler
.data
= data
;
1542 c_register_pragma_1 (space
, name
, ihandler
, false);
1545 /* Register a C pragma handler, using a space and a name. It allows pragma
1546 expansion as in the following example:
1549 #pragma count (NUMBER)
1551 Name expansion is still disallowed. */
1553 c_register_pragma_with_expansion (const char *space
, const char *name
,
1554 pragma_handler_1arg handler
)
1556 internal_pragma_handler ihandler
;
1558 ihandler
.handler
.handler_1arg
= handler
;
1559 ihandler
.extra_data
= false;
1560 ihandler
.data
= NULL
;
1561 c_register_pragma_1 (space
, name
, ihandler
, true);
1564 /* Register a C pragma handler, using a space and a name, it also carries an
1565 extra data field which can be used by the handler. It allows pragma
1566 expansion as in the following example:
1569 #pragma count (NUMBER)
1571 Name expansion is still disallowed. */
1573 c_register_pragma_with_expansion_and_data (const char *space
, const char *name
,
1574 pragma_handler_2arg handler
,
1577 internal_pragma_handler ihandler
;
1579 ihandler
.handler
.handler_2arg
= handler
;
1580 ihandler
.extra_data
= true;
1581 ihandler
.data
= data
;
1582 c_register_pragma_1 (space
, name
, ihandler
, true);
1586 c_invoke_pragma_handler (unsigned int id
)
1588 internal_pragma_handler
*ihandler
;
1589 pragma_handler_1arg handler_1arg
;
1590 pragma_handler_2arg handler_2arg
;
1592 id
-= PRAGMA_FIRST_EXTERNAL
;
1593 ihandler
= ®istered_pragmas
[id
];
1594 if (ihandler
->extra_data
)
1596 handler_2arg
= ihandler
->handler
.handler_2arg
;
1597 handler_2arg (parse_in
, ihandler
->data
);
1601 handler_1arg
= ihandler
->handler
.handler_1arg
;
1602 handler_1arg (parse_in
);
1606 /* Set up front-end pragmas. */
1612 const int n_omp_pragmas
= sizeof (omp_pragmas
) / sizeof (*omp_pragmas
);
1615 for (i
= 0; i
< n_omp_pragmas
; ++i
)
1616 cpp_register_deferred_pragma (parse_in
, "omp", omp_pragmas
[i
].name
,
1617 omp_pragmas
[i
].id
, true, true);
1619 if (flag_openmp
|| flag_openmp_simd
)
1621 const int n_omp_pragmas_simd
= sizeof (omp_pragmas_simd
)
1622 / sizeof (*omp_pragmas
);
1625 for (i
= 0; i
< n_omp_pragmas_simd
; ++i
)
1626 cpp_register_deferred_pragma (parse_in
, "omp", omp_pragmas_simd
[i
].name
,
1627 omp_pragmas_simd
[i
].id
, true, true);
1631 cpp_register_deferred_pragma (parse_in
, NULL
, "simd", PRAGMA_CILK_SIMD
,
1634 if (!flag_preprocess_only
)
1635 cpp_register_deferred_pragma (parse_in
, "GCC", "pch_preprocess",
1636 PRAGMA_GCC_PCH_PREPROCESS
, false, false);
1638 if (!flag_preprocess_only
)
1639 cpp_register_deferred_pragma (parse_in
, "GCC", "ivdep", PRAGMA_IVDEP
, false,
1641 #ifdef HANDLE_PRAGMA_PACK_WITH_EXPANSION
1642 c_register_pragma_with_expansion (0, "pack", handle_pragma_pack
);
1644 c_register_pragma (0, "pack", handle_pragma_pack
);
1646 c_register_pragma (0, "weak", handle_pragma_weak
);
1647 c_register_pragma ("GCC", "visibility", handle_pragma_visibility
);
1649 c_register_pragma ("GCC", "diagnostic", handle_pragma_diagnostic
);
1650 c_register_pragma ("GCC", "target", handle_pragma_target
);
1651 c_register_pragma ("GCC", "optimize", handle_pragma_optimize
);
1652 c_register_pragma ("GCC", "push_options", handle_pragma_push_options
);
1653 c_register_pragma ("GCC", "pop_options", handle_pragma_pop_options
);
1654 c_register_pragma ("GCC", "reset_options", handle_pragma_reset_options
);
1656 c_register_pragma ("STDC", "FLOAT_CONST_DECIMAL64",
1657 handle_pragma_float_const_decimal64
);
1659 c_register_pragma_with_expansion (0, "redefine_extname",
1660 handle_pragma_redefine_extname
);
1662 c_register_pragma_with_expansion (0, "message", handle_pragma_message
);
1666 c_register_pragma (0, "upc", handle_pragma_upc
);
1668 c_register_pragma (0, "pupc", handle_pragma_pupc
);
1669 init_pragma_pupc ();
1672 #ifdef REGISTER_TARGET_PRAGMAS
1673 REGISTER_TARGET_PRAGMAS ();
1676 /* Allow plugins to register their own pragmas. */
1677 invoke_plugin_callbacks (PLUGIN_PRAGMAS
, NULL
);
1680 #include "gt-c-family-c-pragma.h"