Mercurial > hg > CbC > CbC_gcc
comparison gcc/config/darwin-c.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Darwin support needed only by C/C++ frontends. | 1 /* Darwin support needed only by C/C++ frontends. |
2 Copyright (C) 2001-2018 Free Software Foundation, Inc. | 2 Copyright (C) 2001-2020 Free Software Foundation, Inc. |
3 Contributed by Apple Computer Inc. | 3 Contributed by Apple Computer Inc. |
4 | 4 |
5 This file is part of GCC. | 5 This file is part of GCC. |
6 | 6 |
7 GCC is free software; you can redistribute it and/or modify | 7 GCC is free software; you can redistribute it and/or modify |
77 maximum_field_alignment = entry->alignment; | 77 maximum_field_alignment = entry->alignment; |
78 field_align_stack = entry->prev; | 78 field_align_stack = entry->prev; |
79 free (entry); | 79 free (entry); |
80 } | 80 } |
81 else | 81 else |
82 error ("too many #pragma options align=reset"); | 82 error ("too many %<#pragma options%> align=reset"); |
83 } | 83 } |
84 | 84 |
85 /* Handlers for Darwin-specific pragmas. */ | 85 /* Handlers for Darwin-specific pragmas. */ |
86 | 86 |
87 void | 87 void |
97 { | 97 { |
98 const char *arg; | 98 const char *arg; |
99 tree t, x; | 99 tree t, x; |
100 | 100 |
101 if (pragma_lex (&t) != CPP_NAME) | 101 if (pragma_lex (&t) != CPP_NAME) |
102 BAD ("malformed '#pragma options', ignoring"); | 102 BAD ("malformed %<#pragma options%>, ignoring"); |
103 arg = IDENTIFIER_POINTER (t); | 103 arg = IDENTIFIER_POINTER (t); |
104 if (strcmp (arg, "align")) | 104 if (strcmp (arg, "align")) |
105 BAD ("malformed '#pragma options', ignoring"); | 105 BAD ("malformed %<#pragma options%>, ignoring"); |
106 if (pragma_lex (&t) != CPP_EQ) | 106 if (pragma_lex (&t) != CPP_EQ) |
107 BAD ("malformed '#pragma options', ignoring"); | 107 BAD ("malformed %<#pragma options%>, ignoring"); |
108 if (pragma_lex (&t) != CPP_NAME) | 108 if (pragma_lex (&t) != CPP_NAME) |
109 BAD ("malformed '#pragma options', ignoring"); | 109 BAD ("malformed %<#pragma options%>, ignoring"); |
110 | 110 |
111 if (pragma_lex (&x) != CPP_EOF) | 111 if (pragma_lex (&x) != CPP_EOF) |
112 warning (OPT_Wpragmas, "junk at end of '#pragma options'"); | 112 warning (OPT_Wpragmas, "junk at end of %<#pragma options%>"); |
113 | 113 |
114 arg = IDENTIFIER_POINTER (t); | 114 arg = IDENTIFIER_POINTER (t); |
115 if (!strcmp (arg, "mac68k")) | 115 if (!strcmp (arg, "mac68k")) |
116 push_field_alignment (16); | 116 push_field_alignment (16); |
117 else if (!strcmp (arg, "power")) | 117 else if (!strcmp (arg, "power")) |
118 push_field_alignment (0); | 118 push_field_alignment (0); |
119 else if (!strcmp (arg, "reset")) | 119 else if (!strcmp (arg, "reset")) |
120 pop_field_alignment (); | 120 pop_field_alignment (); |
121 else | 121 else |
122 BAD ("malformed '#pragma options align={mac68k|power|reset}', ignoring"); | 122 BAD ("malformed %<#pragma options align={mac68k|power|reset}%>, ignoring"); |
123 } | 123 } |
124 | 124 |
125 /* #pragma unused ([var {, var}*]) */ | 125 /* #pragma unused ([var {, var}*]) */ |
126 | 126 |
127 void | 127 void |
129 { | 129 { |
130 tree decl, x; | 130 tree decl, x; |
131 int tok; | 131 int tok; |
132 | 132 |
133 if (pragma_lex (&x) != CPP_OPEN_PAREN) | 133 if (pragma_lex (&x) != CPP_OPEN_PAREN) |
134 BAD ("missing '(' after '#pragma unused', ignoring"); | 134 BAD ("missing %<(%> after %<#pragma unused%>, ignoring"); |
135 | 135 |
136 while (1) | 136 while (1) |
137 { | 137 { |
138 tok = pragma_lex (&decl); | 138 tok = pragma_lex (&decl); |
139 if (tok == CPP_NAME && decl) | 139 if (tok == CPP_NAME && decl) |
150 break; | 150 break; |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 if (tok != CPP_CLOSE_PAREN) | 154 if (tok != CPP_CLOSE_PAREN) |
155 BAD ("missing ')' after '#pragma unused', ignoring"); | 155 BAD ("missing %<)%> after %<#pragma unused%>, ignoring"); |
156 | 156 |
157 if (pragma_lex (&x) != CPP_EOF) | 157 if (pragma_lex (&x) != CPP_EOF) |
158 BAD ("junk at end of '#pragma unused'"); | 158 BAD ("junk at end of %<#pragma unused%>"); |
159 } | 159 } |
160 | 160 |
161 /* Parse the ms_struct pragma. */ | 161 /* Parse the ms_struct pragma. */ |
162 void | 162 void |
163 darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED) | 163 darwin_pragma_ms_struct (cpp_reader *pfile ATTRIBUTE_UNUSED) |
164 { | 164 { |
165 const char *arg; | 165 const char *arg; |
166 tree t; | 166 tree t; |
167 | 167 |
168 if (pragma_lex (&t) != CPP_NAME) | 168 if (pragma_lex (&t) != CPP_NAME) |
169 BAD ("malformed '#pragma ms_struct', ignoring"); | 169 BAD ("malformed %<#pragma ms_struct%>, ignoring"); |
170 arg = IDENTIFIER_POINTER (t); | 170 arg = IDENTIFIER_POINTER (t); |
171 | 171 |
172 if (!strcmp (arg, "on")) | 172 if (!strcmp (arg, "on")) |
173 darwin_ms_struct = true; | 173 darwin_ms_struct = true; |
174 else if (!strcmp (arg, "off") || !strcmp (arg, "reset")) | 174 else if (!strcmp (arg, "off") || !strcmp (arg, "reset")) |
175 darwin_ms_struct = false; | 175 darwin_ms_struct = false; |
176 else | 176 else |
177 BAD ("malformed '#pragma ms_struct {on|off|reset}', ignoring"); | 177 BAD ("malformed %<#pragma ms_struct {on|off|reset}%>, ignoring"); |
178 | 178 |
179 if (pragma_lex (&t) != CPP_EOF) | 179 if (pragma_lex (&t) != CPP_EOF) |
180 BAD ("junk at end of '#pragma ms_struct'"); | 180 BAD ("junk at end of %<#pragma ms_struct%>"); |
181 } | 181 } |
182 | 182 |
183 static struct frameworks_in_use { | 183 static struct frameworks_in_use { |
184 size_t len; | 184 size_t len; |
185 const char *name; | 185 const char *name; |
461 }; | 461 }; |
462 | 462 |
463 /* Register the GNU objective-C runtime include path if STDINC. */ | 463 /* Register the GNU objective-C runtime include path if STDINC. */ |
464 | 464 |
465 void | 465 void |
466 darwin_register_objc_includes (const char *sysroot, const char *iprefix, | 466 darwin_register_objc_includes (const char *sysroot ATTRIBUTE_UNUSED, |
467 int stdinc) | 467 const char *iprefix, int stdinc) |
468 { | 468 { |
469 const char *fname; | 469 /* If we want standard includes; Register the GNU OBJC runtime include |
470 size_t len; | 470 path if we are compiling OBJC with GNU-runtime. |
471 /* We do not do anything if we do not want the standard includes. */ | 471 This path is compiler-relative, we don't want to prepend the sysroot |
472 if (!stdinc) | 472 since it's not expected to find the headers there. */ |
473 return; | 473 |
474 | 474 if (stdinc && c_dialect_objc () && !flag_next_runtime) |
475 fname = GCC_INCLUDE_DIR "-gnu-runtime"; | 475 { |
476 | 476 const char *fname = GCC_INCLUDE_DIR "-gnu-runtime"; |
477 /* Register the GNU OBJC runtime include path if we are compiling OBJC | |
478 with GNU-runtime. */ | |
479 | |
480 if (c_dialect_objc () && !flag_next_runtime) | |
481 { | |
482 char *str; | 477 char *str; |
483 /* See if our directory starts with the standard prefix. | 478 size_t len; |
479 | |
480 /* See if our directory starts with the standard prefix. | |
484 "Translate" them, i.e. replace /usr/local/lib/gcc... with | 481 "Translate" them, i.e. replace /usr/local/lib/gcc... with |
485 IPREFIX and search them first. */ | 482 IPREFIX and search them first. */ |
486 if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0 && !sysroot | 483 if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0 |
487 && !strncmp (fname, cpp_GCC_INCLUDE_DIR, len)) | 484 && !strncmp (fname, cpp_GCC_INCLUDE_DIR, len)) |
488 { | 485 { |
489 str = concat (iprefix, fname + len, NULL); | 486 str = concat (iprefix, fname + len, NULL); |
490 /* FIXME: wrap the headers for C++awareness. */ | 487 add_path (str, INC_SYSTEM, /*c++aware=*/true, false); |
491 add_path (str, INC_SYSTEM, /*c++aware=*/false, false); | |
492 } | 488 } |
493 | 489 |
494 /* Should this directory start with the sysroot? */ | 490 str = update_path (fname, ""); |
495 if (sysroot) | 491 add_path (str, INC_SYSTEM, /*c++aware=*/true, false); |
496 str = concat (sysroot, fname, NULL); | |
497 else | |
498 str = update_path (fname, ""); | |
499 | |
500 add_path (str, INC_SYSTEM, /*c++aware=*/false, false); | |
501 } | 492 } |
502 } | 493 } |
503 | 494 |
504 | 495 |
505 /* Register all the system framework paths if STDINC is true and setup | 496 /* Register all the system framework paths if STDINC is true and setup |
713 goto fail; | 704 goto fail; |
714 | 705 |
715 return version_macro; | 706 return version_macro; |
716 | 707 |
717 fail: | 708 fail: |
718 error ("unknown value %qs of -mmacosx-version-min", | 709 error ("unknown value %qs of %<-mmacosx-version-min%>", |
719 darwin_macosx_version_min); | 710 darwin_macosx_version_min); |
720 return "1000"; | 711 return "1000"; |
721 } | 712 } |
722 | 713 |
723 /* Define additional CPP flags for Darwin. */ | 714 /* Define additional CPP flags for Darwin. */ |
816 tn = TYPE_NAME (strp); | 807 tn = TYPE_NAME (strp); |
817 if (tn) | 808 if (tn) |
818 tn = DECL_NAME (tn); | 809 tn = DECL_NAME (tn); |
819 return (tn | 810 return (tn |
820 && IDENTIFIER_POINTER (tn) | 811 && IDENTIFIER_POINTER (tn) |
821 && !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", 8)); | 812 && !strncmp (IDENTIFIER_POINTER (tn), "CFStringRef", |
813 strlen ("CFStringRef"))); | |
822 } | 814 } |
823 | 815 |
824 /* At present the behavior of this is undefined and it does nothing. */ | 816 /* At present the behavior of this is undefined and it does nothing. */ |
825 static void | 817 static void |
826 darwin_check_cfstring_format_arg (tree ARG_UNUSED (format_arg), | 818 darwin_check_cfstring_format_arg (tree ARG_UNUSED (format_arg), |