system.h 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240
  1. /* Get common system includes and various definitions and declarations based
  2. on autoconf macros.
  3. Copyright (C) 1998-2019 Free Software Foundation, Inc.
  4. This file is part of GCC.
  5. GCC is free software; you can redistribute it and/or modify it under
  6. the terms of the GNU General Public License as published by the Free
  7. Software Foundation; either version 3, or (at your option) any later
  8. version.
  9. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  12. for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with GCC; see the file COPYING3. If not see
  15. <http://www.gnu.org/licenses/>. */
  16. #ifndef GCC_SYSTEM_H
  17. #define GCC_SYSTEM_H
  18. /* Define this so that inttypes.h defines the PRI?64 macros even
  19. when compiling with a C++ compiler. Define it here so in the
  20. event inttypes.h gets pulled in by another header it is already
  21. defined. */
  22. #define __STDC_FORMAT_MACROS
  23. /* We must include stdarg.h before stdio.h. */
  24. #include <stdarg.h>
  25. #ifndef va_copy
  26. # ifdef __va_copy
  27. # define va_copy(d,s) __va_copy (d, s)
  28. # else
  29. # define va_copy(d,s) ((d) = (s))
  30. # endif
  31. #endif
  32. #ifdef HAVE_STDDEF_H
  33. # include <stddef.h>
  34. #endif
  35. #include <stdio.h>
  36. /* Define a generic NULL if one hasn't already been defined. */
  37. #ifndef NULL
  38. #define NULL 0
  39. #endif
  40. /* Use the unlocked open routines from libiberty. */
  41. /* Some of these are #define on some systems, e.g. on AIX to redirect
  42. the names to 64bit capable functions for LARGE_FILES support. These
  43. redefs are pointless here so we can override them. */
  44. #undef fopen
  45. #undef freopen
  46. #define fopen(PATH, MODE) fopen_unlocked (PATH, MODE)
  47. #define fdopen(FILDES, MODE) fdopen_unlocked (FILDES, MODE)
  48. #define freopen(PATH, MODE, STREAM) freopen_unlocked (PATH, MODE, STREAM)
  49. /* The compiler is not a multi-threaded application and therefore we
  50. do not have to use the locking functions. In fact, using the locking
  51. functions can cause the compiler to be significantly slower under
  52. I/O bound conditions (such as -g -O0 on very large source files).
  53. HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
  54. code is multi-thread safe by default. If it is set to 0, then do
  55. not worry about using the _unlocked functions.
  56. fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
  57. extensions and need to be prototyped by hand (since we do not
  58. define _GNU_SOURCE). */
  59. #if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
  60. # ifdef HAVE_PUTC_UNLOCKED
  61. # undef putc
  62. # define putc(C, Stream) putc_unlocked (C, Stream)
  63. # endif
  64. # ifdef HAVE_PUTCHAR_UNLOCKED
  65. # undef putchar
  66. # define putchar(C) putchar_unlocked (C)
  67. # endif
  68. # ifdef HAVE_GETC_UNLOCKED
  69. # undef getc
  70. # define getc(Stream) getc_unlocked (Stream)
  71. # endif
  72. # ifdef HAVE_GETCHAR_UNLOCKED
  73. # undef getchar
  74. # define getchar() getchar_unlocked ()
  75. # endif
  76. # ifdef HAVE_FPUTC_UNLOCKED
  77. # undef fputc
  78. # define fputc(C, Stream) fputc_unlocked (C, Stream)
  79. # endif
  80. #ifdef __cplusplus
  81. extern "C" {
  82. #endif
  83. # ifdef HAVE_CLEARERR_UNLOCKED
  84. # undef clearerr
  85. # define clearerr(Stream) clearerr_unlocked (Stream)
  86. # if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
  87. extern void clearerr_unlocked (FILE *);
  88. # endif
  89. # endif
  90. # ifdef HAVE_FEOF_UNLOCKED
  91. # undef feof
  92. # define feof(Stream) feof_unlocked (Stream)
  93. # if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
  94. extern int feof_unlocked (FILE *);
  95. # endif
  96. # endif
  97. # ifdef HAVE_FILENO_UNLOCKED
  98. # undef fileno
  99. # define fileno(Stream) fileno_unlocked (Stream)
  100. # if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED
  101. extern int fileno_unlocked (FILE *);
  102. # endif
  103. # endif
  104. # ifdef HAVE_FFLUSH_UNLOCKED
  105. # undef fflush
  106. # define fflush(Stream) fflush_unlocked (Stream)
  107. # if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
  108. extern int fflush_unlocked (FILE *);
  109. # endif
  110. # endif
  111. # ifdef HAVE_FGETC_UNLOCKED
  112. # undef fgetc
  113. # define fgetc(Stream) fgetc_unlocked (Stream)
  114. # if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED
  115. extern int fgetc_unlocked (FILE *);
  116. # endif
  117. # endif
  118. # ifdef HAVE_FGETS_UNLOCKED
  119. # undef fgets
  120. # define fgets(S, n, Stream) fgets_unlocked (S, n, Stream)
  121. # if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
  122. extern char *fgets_unlocked (char *, int, FILE *);
  123. # endif
  124. # endif
  125. # ifdef HAVE_FPUTS_UNLOCKED
  126. # undef fputs
  127. # define fputs(String, Stream) fputs_unlocked (String, Stream)
  128. # if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
  129. extern int fputs_unlocked (const char *, FILE *);
  130. # endif
  131. # endif
  132. # ifdef HAVE_FERROR_UNLOCKED
  133. # undef ferror
  134. # define ferror(Stream) ferror_unlocked (Stream)
  135. # if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
  136. extern int ferror_unlocked (FILE *);
  137. # endif
  138. # endif
  139. # ifdef HAVE_FREAD_UNLOCKED
  140. # undef fread
  141. # define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream)
  142. # if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
  143. extern size_t fread_unlocked (void *, size_t, size_t, FILE *);
  144. # endif
  145. # endif
  146. # ifdef HAVE_FWRITE_UNLOCKED
  147. # undef fwrite
  148. # define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
  149. # if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
  150. extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *);
  151. # endif
  152. # endif
  153. # ifdef HAVE_FPRINTF_UNLOCKED
  154. # undef fprintf
  155. /* We can't use a function-like macro here because we don't know if
  156. we have varargs macros. */
  157. # define fprintf fprintf_unlocked
  158. # if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
  159. extern int fprintf_unlocked (FILE *, const char *, ...);
  160. # endif
  161. # endif
  162. #ifdef __cplusplus
  163. }
  164. #endif
  165. #endif
  166. /* ??? Glibc's fwrite/fread_unlocked macros cause
  167. "warning: signed and unsigned type in conditional expression". */
  168. #undef fread_unlocked
  169. #undef fwrite_unlocked
  170. /* Include <string> before "safe-ctype.h" to avoid GCC poisoning
  171. the ctype macros through safe-ctype.h */
  172. #ifdef __cplusplus
  173. #ifdef INCLUDE_STRING
  174. # include <string>
  175. #endif
  176. #endif
  177. /* There are an extraordinary number of issues with <ctype.h>.
  178. The last straw is that it varies with the locale. Use libiberty's
  179. replacement instead. */
  180. #include "safe-ctype.h"
  181. #include <sys/types.h>
  182. #include <errno.h>
  183. #if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
  184. extern int errno;
  185. #endif
  186. #ifdef __cplusplus
  187. #if defined (INCLUDE_ALGORITHM) || !defined (HAVE_SWAP_IN_UTILITY)
  188. # include <algorithm>
  189. #endif
  190. #ifdef INCLUDE_LIST
  191. # include <list>
  192. #endif
  193. #ifdef INCLUDE_MAP
  194. # include <map>
  195. #endif
  196. #ifdef INCLUDE_SET
  197. # include <set>
  198. #endif
  199. #ifdef INCLUDE_VECTOR
  200. # include <vector>
  201. #endif
  202. # include <cstring>
  203. # include <new>
  204. # include <utility>
  205. #endif
  206. /* Some of glibc's string inlines cause warnings. Plus we'd rather
  207. rely on (and therefore test) GCC's string builtins. */
  208. #define __NO_STRING_INLINES
  209. #ifdef STRING_WITH_STRINGS
  210. # include <string.h>
  211. # include <strings.h>
  212. #else
  213. # ifdef HAVE_STRING_H
  214. # include <string.h>
  215. # else
  216. # ifdef HAVE_STRINGS_H
  217. # include <strings.h>
  218. # endif
  219. # endif
  220. #endif
  221. #ifdef HAVE_STDLIB_H
  222. # include <stdlib.h>
  223. #endif
  224. /* When compiling C++ we need to include <cstdlib> as well as <stdlib.h> so
  225. that it is processed before we poison "malloc"; otherwise, if a source
  226. file uses a standard library header that includes <cstdlib>, we will get
  227. an error about 'using std::malloc'. */
  228. #ifdef __cplusplus
  229. #include <cstdlib>
  230. #endif
  231. /* Undef vec_free from AIX stdlib.h header which conflicts with vec.h. */
  232. #undef vec_free
  233. /* If we don't have an overriding definition, set SUCCESS_EXIT_CODE and
  234. FATAL_EXIT_CODE to EXIT_SUCCESS and EXIT_FAILURE respectively,
  235. or 0 and 1 if those macros are not defined. */
  236. #ifndef SUCCESS_EXIT_CODE
  237. # ifdef EXIT_SUCCESS
  238. # define SUCCESS_EXIT_CODE EXIT_SUCCESS
  239. # else
  240. # define SUCCESS_EXIT_CODE 0
  241. # endif
  242. #endif
  243. #ifndef FATAL_EXIT_CODE
  244. # ifdef EXIT_FAILURE
  245. # define FATAL_EXIT_CODE EXIT_FAILURE
  246. # else
  247. # define FATAL_EXIT_CODE 1
  248. # endif
  249. #endif
  250. #define ICE_EXIT_CODE 4
  251. #ifdef HAVE_UNISTD_H
  252. # include <unistd.h>
  253. #endif
  254. #ifdef HAVE_SYS_PARAM_H
  255. # include <sys/param.h>
  256. /* We use these identifiers later and they appear in some vendor param.h's. */
  257. # undef PREFETCH
  258. # undef m_slot
  259. #endif
  260. #if HAVE_LIMITS_H
  261. # include <limits.h>
  262. #endif
  263. /* A macro to determine whether a VALUE lies inclusively within a
  264. certain range without evaluating the VALUE more than once. This
  265. macro won't warn if the VALUE is unsigned and the LOWER bound is
  266. zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER
  267. bound *is* evaluated twice, and LOWER must not be greater than
  268. UPPER. However the bounds themselves can be either positive or
  269. negative. */
  270. #define IN_RANGE(VALUE, LOWER, UPPER) \
  271. ((unsigned HOST_WIDE_INT) (VALUE) - (unsigned HOST_WIDE_INT) (LOWER) \
  272. <= (unsigned HOST_WIDE_INT) (UPPER) - (unsigned HOST_WIDE_INT) (LOWER))
  273. /* Infrastructure for defining missing _MAX and _MIN macros. Note that
  274. macros defined with these cannot be used in #if. */
  275. /* The extra casts work around common compiler bugs. */
  276. #define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
  277. /* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
  278. It is necessary at least when t == time_t. */
  279. #define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
  280. ? (t) 1 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
  281. #define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
  282. /* Use that infrastructure to provide a few constants. */
  283. #ifndef UCHAR_MAX
  284. # define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
  285. #endif
  286. #ifdef TIME_WITH_SYS_TIME
  287. # include <sys/time.h>
  288. # include <time.h>
  289. #else
  290. # if HAVE_SYS_TIME_H
  291. # include <sys/time.h>
  292. # else
  293. # ifdef HAVE_TIME_H
  294. # include <time.h>
  295. # endif
  296. # endif
  297. #endif
  298. #ifdef HAVE_FCNTL_H
  299. # include <fcntl.h>
  300. #else
  301. # ifdef HAVE_SYS_FILE_H
  302. # include <sys/file.h>
  303. # endif
  304. #endif
  305. #ifndef SEEK_SET
  306. # define SEEK_SET 0
  307. # define SEEK_CUR 1
  308. # define SEEK_END 2
  309. #endif
  310. #ifndef F_OK
  311. # define F_OK 0
  312. # define X_OK 1
  313. # define W_OK 2
  314. # define R_OK 4
  315. #endif
  316. #ifndef O_RDONLY
  317. # define O_RDONLY 0
  318. #endif
  319. #ifndef O_WRONLY
  320. # define O_WRONLY 1
  321. #endif
  322. #ifndef O_BINARY
  323. # define O_BINARY 0
  324. #endif
  325. /* Some systems define these in, e.g., param.h. We undefine these names
  326. here to avoid the warnings. We prefer to use our definitions since we
  327. know they are correct. */
  328. #undef MIN
  329. #undef MAX
  330. #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
  331. #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
  332. /* Returns the least number N such that N * Y >= X. */
  333. #define CEIL(x,y) (((x) + (y) - 1) / (y))
  334. /* This macro rounds x up to the y boundary. */
  335. #define ROUND_UP(x,y) (((x) + (y) - 1) & ~((y) - 1))
  336. /* This macro rounds x down to the y boundary. */
  337. #define ROUND_DOWN(x,y) ((x) & ~((y) - 1))
  338. #ifdef HAVE_SYS_WAIT_H
  339. #include <sys/wait.h>
  340. #endif
  341. #ifndef WIFSIGNALED
  342. #define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
  343. #endif
  344. #ifndef WTERMSIG
  345. #define WTERMSIG(S) ((S) & 0x7f)
  346. #endif
  347. #ifndef WIFEXITED
  348. #define WIFEXITED(S) (((S) & 0xff) == 0)
  349. #endif
  350. #ifndef WEXITSTATUS
  351. #define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
  352. #endif
  353. #ifndef WSTOPSIG
  354. #define WSTOPSIG WEXITSTATUS
  355. #endif
  356. #ifndef WCOREDUMP
  357. #define WCOREDUMP(S) ((S) & WCOREFLG)
  358. #endif
  359. #ifndef WCOREFLG
  360. #define WCOREFLG 0200
  361. #endif
  362. #include <signal.h>
  363. #if !defined (SIGCHLD) && defined (SIGCLD)
  364. # define SIGCHLD SIGCLD
  365. #endif
  366. #ifdef HAVE_SYS_MMAN_H
  367. # include <sys/mman.h>
  368. #endif
  369. #ifndef MAP_FAILED
  370. # define MAP_FAILED ((void *)-1)
  371. #endif
  372. #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
  373. # define MAP_ANONYMOUS MAP_ANON
  374. #endif
  375. #ifdef HAVE_SYS_RESOURCE_H
  376. # include <sys/resource.h>
  377. #endif
  378. #ifdef HAVE_SYS_TIMES_H
  379. # include <sys/times.h>
  380. #endif
  381. /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
  382. are defined to 0 then we must provide the relevant declaration
  383. here. These checks will be in the undefined state while configure
  384. is running so be careful to test "defined (HAVE_DECL_*)". */
  385. #ifdef __cplusplus
  386. extern "C" {
  387. #endif
  388. #if defined (HAVE_DECL_ATOF) && !HAVE_DECL_ATOF
  389. extern double atof (const char *);
  390. #endif
  391. #if defined (HAVE_DECL_ATOL) && !HAVE_DECL_ATOL
  392. extern long atol (const char *);
  393. #endif
  394. #if defined (HAVE_DECL_FREE) && !HAVE_DECL_FREE
  395. extern void free (void *);
  396. #endif
  397. #if defined (HAVE_DECL_GETCWD) && !HAVE_DECL_GETCWD
  398. extern char *getcwd (char *, size_t);
  399. #endif
  400. #if defined (HAVE_DECL_GETENV) && !HAVE_DECL_GETENV
  401. extern char *getenv (const char *);
  402. #endif
  403. #if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT
  404. extern int getopt (int, char * const *, const char *);
  405. #endif
  406. #if defined (HAVE_DECL_GETPAGESIZE) && !HAVE_DECL_GETPAGESIZE
  407. extern int getpagesize (void);
  408. #endif
  409. #if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD
  410. extern char *getwd (char *);
  411. #endif
  412. #if defined (HAVE_DECL_SBRK) && !HAVE_DECL_SBRK
  413. extern void *sbrk (int);
  414. #endif
  415. #if defined (HAVE_DECL_SETENV) && !HAVE_DECL_SETENV
  416. int setenv(const char *, const char *, int);
  417. #endif
  418. #if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR
  419. extern char *strstr (const char *, const char *);
  420. #endif
  421. #if defined (HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY
  422. extern char *stpcpy (char *, const char *);
  423. #endif
  424. #if defined (HAVE_DECL_UNSETENV) && !HAVE_DECL_UNSETENV
  425. int unsetenv(const char *);
  426. #endif
  427. #if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC
  428. extern void *malloc (size_t);
  429. #endif
  430. #if defined (HAVE_DECL_CALLOC) && !HAVE_DECL_CALLOC
  431. extern void *calloc (size_t, size_t);
  432. #endif
  433. #if defined (HAVE_DECL_REALLOC) && !HAVE_DECL_REALLOC
  434. extern void *realloc (void *, size_t);
  435. #endif
  436. #ifdef __cplusplus
  437. }
  438. #endif
  439. #ifdef HAVE_STDINT_H
  440. #include <stdint.h>
  441. #endif
  442. #ifdef HAVE_INTTYPES_H
  443. #include <inttypes.h>
  444. #endif
  445. #ifdef __cplusplus
  446. extern "C" {
  447. #endif
  448. /* If the system doesn't provide strsignal, we get it defined in
  449. libiberty but no declaration is supplied. */
  450. #if !defined (HAVE_STRSIGNAL) \
  451. || (defined (HAVE_DECL_STRSIGNAL) && !HAVE_DECL_STRSIGNAL)
  452. # ifndef strsignal
  453. extern const char *strsignal (int);
  454. # endif
  455. #endif
  456. #ifdef HAVE_GETRLIMIT
  457. # if defined (HAVE_DECL_GETRLIMIT) && !HAVE_DECL_GETRLIMIT
  458. # ifndef getrlimit
  459. struct rlimit;
  460. extern int getrlimit (int, struct rlimit *);
  461. # endif
  462. # endif
  463. #endif
  464. #ifdef HAVE_SETRLIMIT
  465. # if defined (HAVE_DECL_SETRLIMIT) && !HAVE_DECL_SETRLIMIT
  466. # ifndef setrlimit
  467. struct rlimit;
  468. extern int setrlimit (int, const struct rlimit *);
  469. # endif
  470. # endif
  471. #endif
  472. #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
  473. extern void abort (void);
  474. #endif
  475. #if defined (HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
  476. extern int snprintf (char *, size_t, const char *, ...);
  477. #endif
  478. #if defined (HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
  479. extern int vsnprintf (char *, size_t, const char *, va_list);
  480. #endif
  481. #ifdef __cplusplus
  482. }
  483. #endif
  484. /* 1 if we have C99 designated initializers. */
  485. #if !defined(HAVE_DESIGNATED_INITIALIZERS)
  486. #ifdef __cplusplus
  487. #define HAVE_DESIGNATED_INITIALIZERS 0
  488. #else
  489. #define HAVE_DESIGNATED_INITIALIZERS \
  490. ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
  491. #endif
  492. #endif
  493. #if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
  494. #ifdef __cplusplus
  495. #define HAVE_DESIGNATED_UNION_INITIALIZERS (GCC_VERSION >= 4007)
  496. #else
  497. #define HAVE_DESIGNATED_UNION_INITIALIZERS \
  498. ((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L))
  499. #endif
  500. #endif
  501. #if HAVE_SYS_STAT_H
  502. # include <sys/stat.h>
  503. #endif
  504. /* Test if something is a normal file. */
  505. #ifndef S_ISREG
  506. #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  507. #endif
  508. /* Test if something is a directory. */
  509. #ifndef S_ISDIR
  510. #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  511. #endif
  512. /* Test if something is a character special file. */
  513. #ifndef S_ISCHR
  514. #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  515. #endif
  516. /* Test if something is a block special file. */
  517. #ifndef S_ISBLK
  518. #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  519. #endif
  520. /* Test if something is a socket. */
  521. #ifndef S_ISSOCK
  522. # ifdef S_IFSOCK
  523. # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  524. # else
  525. # define S_ISSOCK(m) 0
  526. # endif
  527. #endif
  528. /* Test if something is a FIFO. */
  529. #ifndef S_ISFIFO
  530. # ifdef S_IFIFO
  531. # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  532. # else
  533. # define S_ISFIFO(m) 0
  534. # endif
  535. #endif
  536. /* Define well known filenos if the system does not define them. */
  537. #ifndef STDIN_FILENO
  538. # define STDIN_FILENO 0
  539. #endif
  540. #ifndef STDOUT_FILENO
  541. # define STDOUT_FILENO 1
  542. #endif
  543. #ifndef STDERR_FILENO
  544. # define STDERR_FILENO 2
  545. #endif
  546. /* Some systems have mkdir that takes a single argument. */
  547. #ifdef MKDIR_TAKES_ONE_ARG
  548. # define mkdir(a,b) mkdir (a)
  549. #endif
  550. #ifndef HAVE_KILL
  551. # define kill(p,s) raise (s)
  552. #endif
  553. /* Provide a way to print an address via printf. */
  554. #ifndef HOST_PTR_PRINTF
  555. #define HOST_PTR_PRINTF "%p"
  556. #endif /* ! HOST_PTR_PRINTF */
  557. /* By default, colon separates directories in a path. */
  558. #ifndef PATH_SEPARATOR
  559. #define PATH_SEPARATOR ':'
  560. #endif
  561. /* Filename handling macros. */
  562. #include "filenames.h"
  563. /* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */
  564. #ifndef DIR_SEPARATOR
  565. # define DIR_SEPARATOR '/'
  566. # ifdef HAVE_DOS_BASED_FILE_SYSTEM
  567. # define DIR_SEPARATOR_2 '\\'
  568. # endif
  569. #endif
  570. #if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H)
  571. /* If plugin support is enabled, we could use libdl. */
  572. #include <dlfcn.h>
  573. #endif
  574. /* Do not introduce a gmp.h dependency on the build system. */
  575. #ifndef GENERATOR_FILE
  576. #include <gmp.h>
  577. #endif
  578. /* Get libiberty declarations. */
  579. #include "libiberty.h"
  580. #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
  581. #undef FLOAT /* Likewise. */
  582. #undef ABS /* Likewise. */
  583. #undef PC /* Likewise. */
  584. /* Provide a default for the HOST_BIT_BUCKET.
  585. This suffices for POSIX-like hosts. */
  586. #ifndef HOST_BIT_BUCKET
  587. #define HOST_BIT_BUCKET "/dev/null"
  588. #endif
  589. #ifndef offsetof
  590. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
  591. #endif
  592. /* Various error reporting routines want to use __FUNCTION__. */
  593. #if (GCC_VERSION < 2007)
  594. #ifndef __FUNCTION__
  595. #define __FUNCTION__ "?"
  596. #endif /* ! __FUNCTION__ */
  597. #endif
  598. /* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
  599. the most likely value of A is B. This feature was added at some point
  600. between 2.95 and 3.0. Let's use 3.0 as the lower bound for now. */
  601. #if (GCC_VERSION < 3000)
  602. #define __builtin_expect(a, b) (a)
  603. #endif
  604. /* Some of the headers included by <memory> can use "abort" within a
  605. namespace, e.g. "_VSTD::abort();", which fails after we use the
  606. preprocessor to redefine "abort" as "fancy_abort" below.
  607. Given that unique-ptr.h can use "free", we need to do this after "free"
  608. is declared but before "abort" is overridden. */
  609. #ifdef INCLUDE_UNIQUE_PTR
  610. # include "unique-ptr.h"
  611. #endif
  612. /* Redefine abort to report an internal error w/o coredump, and
  613. reporting the location of the error in the source file. */
  614. extern void fancy_abort (const char *, int, const char *)
  615. ATTRIBUTE_NORETURN ATTRIBUTE_COLD;
  616. #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
  617. /* Use gcc_assert(EXPR) to test invariants. */
  618. #if ENABLE_ASSERT_CHECKING
  619. #define gcc_assert(EXPR) \
  620. ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
  621. #elif (GCC_VERSION >= 4005)
  622. #define gcc_assert(EXPR) \
  623. ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
  624. #else
  625. /* Include EXPR, so that unused variable warnings do not occur. */
  626. #define gcc_assert(EXPR) ((void)(0 && (EXPR)))
  627. #endif
  628. #if CHECKING_P
  629. #define gcc_checking_assert(EXPR) gcc_assert (EXPR)
  630. #else
  631. /* N.B.: in release build EXPR is not evaluated. */
  632. #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
  633. #endif
  634. #if GCC_VERSION >= 4000
  635. #define ALWAYS_INLINE inline __attribute__ ((always_inline))
  636. #else
  637. #define ALWAYS_INLINE inline
  638. #endif
  639. /* Use gcc_unreachable() to mark unreachable locations (like an
  640. unreachable default case of a switch. Do not use gcc_assert(0). */
  641. #if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
  642. #define gcc_unreachable() __builtin_unreachable ()
  643. #else
  644. #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
  645. #endif
  646. #if GCC_VERSION >= 7000 && defined(__has_attribute)
  647. # if __has_attribute(fallthrough)
  648. # define gcc_fallthrough() __attribute__((fallthrough))
  649. # else
  650. # define gcc_fallthrough()
  651. # endif
  652. #else
  653. # define gcc_fallthrough()
  654. #endif
  655. #if GCC_VERSION >= 3001
  656. #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
  657. #else
  658. #define STATIC_CONSTANT_P(X) (false && (X))
  659. #endif
  660. /* static_assert (COND, MESSAGE) is available in C++11 onwards. */
  661. #if __cplusplus >= 201103L
  662. #define STATIC_ASSERT(X) \
  663. static_assert ((X), #X)
  664. #else
  665. #define STATIC_ASSERT(X) \
  666. typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED
  667. #endif
  668. /* Provide a fake boolean type. We make no attempt to use the
  669. C99 _Bool, as it may not be available in the bootstrap compiler,
  670. and even if it is, it is liable to be buggy.
  671. This must be after all inclusion of system headers, as some of
  672. them will mess us up. */
  673. #undef TRUE
  674. #undef FALSE
  675. #ifdef __cplusplus
  676. /* Obsolete. */
  677. # define TRUE true
  678. # define FALSE false
  679. #else /* !__cplusplus */
  680. # undef bool
  681. # undef true
  682. # undef false
  683. # define bool unsigned char
  684. # define true 1
  685. # define false 0
  686. /* Obsolete. */
  687. # define TRUE true
  688. # define FALSE false
  689. #endif /* !__cplusplus */
  690. /* Some compilers do not allow the use of unsigned char in bitfields. */
  691. #define BOOL_BITFIELD unsigned int
  692. /* GCC older than 4.4 have broken C++ value initialization handling, see
  693. PR11309, PR30111, PR33916, PR82939 and PR84405 for more details. */
  694. #if GCC_VERSION > 0 && GCC_VERSION < 4004 && !defined(__clang__)
  695. # define BROKEN_VALUE_INITIALIZATION
  696. #endif
  697. /* As the last action in this file, we poison the identifiers that
  698. shouldn't be used. Note, luckily gcc-3.0's token-based integrated
  699. preprocessor won't trip on poisoned identifiers that arrive from
  700. the expansion of macros. E.g. #define strrchr rindex, won't error
  701. if rindex is poisoned after this directive is issued and later on
  702. strrchr is called.
  703. Note: We define bypass macros for the few cases where we really
  704. want to use the libc memory allocation routines. Otherwise we
  705. insist you use the "x" versions from libiberty. */
  706. #define really_call_malloc malloc
  707. #define really_call_calloc calloc
  708. #define really_call_realloc realloc
  709. #if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC)
  710. /* Flex and bison use malloc and realloc. Yuk. Note that this means
  711. really_call_* cannot be used in a .l or .y file. */
  712. #define malloc xmalloc
  713. #define realloc xrealloc
  714. #endif
  715. #if (GCC_VERSION >= 3000)
  716. /* Note autoconf checks for prototype declarations and includes
  717. system.h while doing so. Only poison these tokens if actually
  718. compiling gcc, so that the autoconf declaration tests for malloc
  719. etc don't spuriously fail. */
  720. #ifdef IN_GCC
  721. #ifndef USES_ISL
  722. #undef calloc
  723. #undef strdup
  724. #undef strndup
  725. #pragma GCC poison calloc strdup strndup
  726. #endif
  727. #if !defined(FLEX_SCANNER) && !defined(YYBISON)
  728. #undef malloc
  729. #undef realloc
  730. #pragma GCC poison malloc realloc
  731. #endif
  732. /* The %m format should be used when GCC's main diagnostic functions
  733. supporting %m are available, and xstrerror from libiberty
  734. otherwise. */
  735. #undef strerror
  736. #pragma GCC poison strerror
  737. /* loc_t is defined on some systems and too inviting for some
  738. programmers to avoid. */
  739. #undef loc_t
  740. #pragma GCC poison loc_t
  741. /* Old target macros that have moved to the target hooks structure. */
  742. #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \
  743. FUNCTION_PROLOGUE FUNCTION_EPILOGUE \
  744. FUNCTION_END_PROLOGUE FUNCTION_BEGIN_EPILOGUE \
  745. DECL_MACHINE_ATTRIBUTES COMP_TYPE_ATTRIBUTES INSERT_ATTRIBUTES \
  746. VALID_MACHINE_DECL_ATTRIBUTE VALID_MACHINE_TYPE_ATTRIBUTE \
  747. SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \
  748. MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \
  749. MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \
  750. ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE \
  751. WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \
  752. ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL \
  753. ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS \
  754. ADDRESS_COST MACHINE_DEPENDENT_REORG ASM_FILE_START ASM_FILE_END \
  755. ASM_SIMPLIFY_DWARF_ADDR INIT_TARGET_OPTABS INIT_SUBTARGET_OPTABS \
  756. INIT_GOFAST_OPTABS MULSI3_LIBCALL MULDI3_LIBCALL DIVSI3_LIBCALL \
  757. DIVDI3_LIBCALL UDIVSI3_LIBCALL UDIVDI3_LIBCALL MODSI3_LIBCALL \
  758. MODDI3_LIBCALL UMODSI3_LIBCALL UMODDI3_LIBCALL BUILD_VA_LIST_TYPE \
  759. PRETEND_OUTGOING_VARARGS_NAMED STRUCT_VALUE_INCOMING_REGNUM \
  760. ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS PROMOTE_FUNCTION_MODE \
  761. STRUCT_VALUE_INCOMING STRICT_ARGUMENT_NAMING \
  762. PROMOTE_FUNCTION_RETURN PROMOTE_PROTOTYPES STRUCT_VALUE_REGNUM \
  763. SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS \
  764. DEFAULT_SHORT_ENUMS SPLIT_COMPLEX_ARGS MD_ASM_CLOBBERS \
  765. HANDLE_PRAGMA_REDEFINE_EXTNAME HANDLE_PRAGMA_EXTERN_PREFIX \
  766. MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE \
  767. VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN \
  768. FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \
  769. ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \
  770. CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE \
  771. TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING \
  772. RETURN_POPS_ARGS UNITS_PER_SIMD_WORD OVERRIDE_OPTIONS \
  773. OPTIMIZATION_OPTIONS CLASS_LIKELY_SPILLED_P \
  774. USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO \
  775. CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME \
  776. HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P ALWAYS_STRIP_DOTDOT \
  777. OUTPUT_ADDR_CONST_EXTRA SMALL_REGISTER_CLASSES ASM_OUTPUT_IDENT \
  778. ASM_BYTE_OP MEMBER_TYPE_FORCES_BLK LIBGCC2_HAS_SF_MODE \
  779. LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE \
  780. CLEAR_BY_PIECES_P MOVE_BY_PIECES_P SET_BY_PIECES_P \
  781. STORE_BY_PIECES_P TARGET_FLT_EVAL_METHOD \
  782. HARD_REGNO_CALL_PART_CLOBBERED HARD_REGNO_MODE_OK \
  783. MODES_TIEABLE_P FUNCTION_ARG_PADDING SLOW_UNALIGNED_ACCESS \
  784. HARD_REGNO_NREGS SECONDARY_MEMORY_NEEDED_MODE \
  785. SECONDARY_MEMORY_NEEDED CANNOT_CHANGE_MODE_CLASS \
  786. TRULY_NOOP_TRUNCATION FUNCTION_ARG_OFFSET CONSTANT_ALIGNMENT \
  787. STARTING_FRAME_OFFSET
  788. /* Target macros only used for code built for the target, that have
  789. moved to libgcc-tm.h or have never been present elsewhere. */
  790. #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX \
  791. MD_UNWIND_SUPPORT MD_FROB_UPDATE_CONTEXT ENABLE_EXECUTE_STACK \
  792. REG_VALUE_IN_UNWIND_CONTEXT ASSUME_EXTENDED_UNWIND_CONTEXT
  793. /* Other obsolete target macros, or macros that used to be in target
  794. headers and were not used, and may be obsolete or may never have
  795. been used. */
  796. #pragma GCC poison INT_ASM_OP ASM_OUTPUT_EH_REGION_BEG CPP_PREDEFINES \
  797. ASM_OUTPUT_EH_REGION_END ASM_OUTPUT_LABELREF_AS_INT SMALL_STACK \
  798. DOESNT_NEED_UNWINDER EH_TABLE_LOOKUP OBJC_SELECTORS_WITHOUT_LABELS \
  799. OMIT_EH_TABLE EASY_DIV_EXPR IMPLICIT_FIX_EXPR \
  800. LONGJMP_RESTORE_FROM_STACK MAX_INT_TYPE_SIZE ASM_IDENTIFY_GCC \
  801. STDC_VALUE TRAMPOLINE_ALIGN ASM_IDENTIFY_GCC_AFTER_SOURCE \
  802. SLOW_ZERO_EXTEND SUBREG_REGNO_OFFSET DWARF_LINE_MIN_INSTR_LENGTH \
  803. TRADITIONAL_RETURN_FLOAT NO_BUILTIN_SIZE_TYPE \
  804. NO_BUILTIN_PTRDIFF_TYPE NO_BUILTIN_WCHAR_TYPE NO_BUILTIN_WINT_TYPE \
  805. BLOCK_PROFILER BLOCK_PROFILER_CODE FUNCTION_BLOCK_PROFILER \
  806. FUNCTION_BLOCK_PROFILER_EXIT MACHINE_STATE_SAVE \
  807. MACHINE_STATE_RESTORE SCCS_DIRECTIVE SECTION_ASM_OP BYTEORDER \
  808. ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL HOST_WORDS_BIG_ENDIAN \
  809. OBJC_PROLOGUE ALLOCATE_TRAMPOLINE HANDLE_PRAGMA ROUND_TYPE_SIZE \
  810. ROUND_TYPE_SIZE_UNIT CONST_SECTION_ASM_OP CRT_GET_RFIB_TEXT \
  811. DBX_LBRAC_FIRST DBX_OUTPUT_ENUM DBX_OUTPUT_SOURCE_FILENAME \
  812. DBX_WORKING_DIRECTORY INSN_CACHE_DEPTH INSN_CACHE_SIZE \
  813. INSN_CACHE_LINE_WIDTH INIT_SECTION_PREAMBLE NEED_ATEXIT ON_EXIT \
  814. EXIT_BODY OBJECT_FORMAT_ROSE MULTIBYTE_CHARS MAP_CHARACTER \
  815. LIBGCC_NEEDS_DOUBLE FINAL_PRESCAN_LABEL DEFAULT_CALLER_SAVES \
  816. LOAD_ARGS_REVERSED MAX_INTEGER_COMPUTATION_MODE \
  817. CONVERT_HARD_REGISTER_TO_SSA_P ASM_OUTPUT_MAIN_SOURCE_FILENAME \
  818. FIRST_INSN_ADDRESS TEXT_SECTION SHARED_BSS_SECTION_ASM_OP \
  819. PROMOTED_MODE EXPAND_BUILTIN_VA_END \
  820. LINKER_DOES_NOT_WORK_WITH_DWARF2 FUNCTION_ARG_KEEP_AS_REFERENCE \
  821. GIV_SORT_CRITERION MAX_LONG_TYPE_SIZE MAX_LONG_DOUBLE_TYPE_SIZE \
  822. MAX_WCHAR_TYPE_SIZE SHARED_SECTION_ASM_OP INTEGRATE_THRESHOLD \
  823. FINAL_REG_PARM_STACK_SPACE MAYBE_REG_PARM_STACK_SPACE \
  824. TRADITIONAL_PIPELINE_INTERFACE DFA_PIPELINE_INTERFACE \
  825. DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE \
  826. SUNOS4_SHARED_LIBRARIES PROMOTE_FOR_CALL_ONLY \
  827. SPACE_AFTER_L_OPTION NO_RECURSIVE_FUNCTION_CSE \
  828. DEFAULT_MAIN_RETURN TARGET_MEM_FUNCTIONS EXPAND_BUILTIN_VA_ARG \
  829. COLLECT_PARSE_FLAG DWARF2_GENERATE_TEXT_SECTION_LABEL WINNING_GDB \
  830. ASM_OUTPUT_FILENAME ASM_OUTPUT_SOURCE_LINE FILE_NAME_JOINER \
  831. GDB_INV_REF_REGPARM_STABS_LETTER DBX_MEMPARM_STABS_LETTER \
  832. PUT_SDB_SRC_FILE STABS_GCC_MARKER DBX_OUTPUT_FUNCTION_END \
  833. DBX_OUTPUT_GCC_MARKER DBX_FINISH_SYMBOL SDB_GENERATE_FAKE \
  834. NON_SAVING_SETJMP TARGET_LATE_RTL_PROLOGUE_EPILOGUE \
  835. CASE_DROPS_THROUGH TARGET_BELL TARGET_BS TARGET_CR TARGET_DIGIT0 \
  836. TARGET_ESC TARGET_FF TARGET_NEWLINE TARGET_TAB TARGET_VT \
  837. LINK_LIBGCC_SPECIAL DONT_ACCESS_GBLS_AFTER_EPILOGUE \
  838. TARGET_OPTIONS TARGET_SWITCHES EXTRA_CC_MODES FINALIZE_PIC \
  839. PREDICATE_CODES SPECIAL_MODE_PREDICATES UNALIGNED_WORD_ASM_OP \
  840. EXTRA_SECTIONS EXTRA_SECTION_FUNCTIONS READONLY_DATA_SECTION \
  841. TARGET_ASM_EXCEPTION_SECTION TARGET_ASM_EH_FRAME_SECTION \
  842. SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \
  843. ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE \
  844. STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \
  845. ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \
  846. ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES \
  847. SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG \
  848. TARGET_OPTION_TRANSLATE_TABLE HANDLE_PRAGMA_PACK_PUSH_POP \
  849. HANDLE_SYSV_PRAGMA HANDLE_PRAGMA_WEAK CONDITIONAL_REGISTER_USAGE \
  850. FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST \
  851. USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE \
  852. FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \
  853. MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS \
  854. SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES \
  855. PREFERRED_OUTPUT_RELOAD_CLASS SYSTEM_INCLUDE_DIR \
  856. STANDARD_INCLUDE_DIR STANDARD_INCLUDE_COMPONENT \
  857. LINK_ELIMINATE_DUPLICATE_LDIRECTORIES MIPS_DEBUGGING_INFO \
  858. IDENT_ASM_OP ALL_COP_ADDITIONAL_REGISTER_NAMES DBX_OUTPUT_LBRAC \
  859. DBX_OUTPUT_NFUN DBX_OUTPUT_RBRAC RANGE_TEST_NON_SHORT_CIRCUIT \
  860. REAL_VALUE_TRUNCATE REVERSE_CONDEXEC_PREDICATES_P \
  861. TARGET_ALIGN_ANON_BITFIELDS TARGET_NARROW_VOLATILE_BITFIELDS \
  862. IDENT_ASM_OP UNALIGNED_SHORT_ASM_OP UNALIGNED_INT_ASM_OP \
  863. UNALIGNED_LONG_ASM_OP UNALIGNED_DOUBLE_INT_ASM_OP \
  864. USE_COMMON_FOR_ONE_ONLY IFCVT_EXTRA_FIELDS IFCVT_INIT_EXTRA_FIELDS \
  865. CASE_USE_BIT_TESTS FIXUNS_TRUNC_LIKE_FIX_TRUNC \
  866. GO_IF_MODE_DEPENDENT_ADDRESS DELAY_SLOTS_FOR_EPILOGUE \
  867. ELIGIBLE_FOR_EPILOGUE_DELAY TARGET_C99_FUNCTIONS TARGET_HAS_SINCOS \
  868. REG_CLASS_FROM_LETTER CONST_OK_FOR_LETTER_P \
  869. CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT \
  870. REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT \
  871. EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \
  872. EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \
  873. CALLER_SAVE_PROFITABLE LARGEST_EXPONENT_IS_NORMAL \
  874. ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT \
  875. LIBGCC2_LONG_DOUBLE_TYPE_SIZE STRUCT_VALUE \
  876. EH_FRAME_IN_DATA_SECTION TARGET_FLT_EVAL_METHOD_NON_DEFAULT \
  877. JCR_SECTION_NAME TARGET_USE_JCR_SECTION SDB_DEBUGGING_INFO \
  878. SDB_DEBUG NO_IMPLICIT_EXTERN_C
  879. /* Hooks that are no longer used. */
  880. #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \
  881. LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES \
  882. LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
  883. LANG_HOOKS_PUSHLEVEL LANG_HOOKS_SET_BLOCK \
  884. LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \
  885. LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION \
  886. TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN \
  887. LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES \
  888. TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION \
  889. TARGET_IRA_COVER_CLASSES TARGET_HELP \
  890. TARGET_HANDLE_PRAGMA_EXTERN_PREFIX \
  891. TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN \
  892. TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD \
  893. TARGET_MD_ASM_CLOBBERS TARGET_RELAXED_ORDERING \
  894. EXTENDED_SDB_BASIC_TYPES TARGET_INVALID_PARAMETER_TYPE \
  895. TARGET_INVALID_RETURN_TYPE
  896. /* Arrays that were deleted in favor of a functional interface. */
  897. #pragma GCC poison built_in_decls implicit_built_in_decls
  898. /* Hooks into libgcc2. */
  899. #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN \
  900. LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
  901. /* Miscellaneous macros that are no longer used. */
  902. #pragma GCC poison USE_MAPPED_LOCATION GET_ENVIRONMENT
  903. /* Libiberty macros that are no longer used in GCC. */
  904. #undef ANSI_PROTOTYPES
  905. #undef PTR_CONST
  906. #undef LONG_DOUBLE
  907. #undef VPARAMS
  908. #undef VA_OPEN
  909. #undef VA_FIXEDARG
  910. #undef VA_CLOSE
  911. #undef VA_START
  912. #pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \
  913. VA_FIXEDARG VA_CLOSE VA_START
  914. #endif /* IN_GCC */
  915. /* Front ends should never have to include middle-end headers. Enforce
  916. this by poisoning the header double-include protection defines. */
  917. #ifdef IN_GCC_FRONTEND
  918. #pragma GCC poison GCC_RTL_H GCC_EXCEPT_H GCC_EXPR_H
  919. #endif
  920. /* Note: not all uses of the `index' token (e.g. variable names and
  921. structure members) have been eliminated. */
  922. #undef bcopy
  923. #undef bzero
  924. #undef bcmp
  925. #undef rindex
  926. #pragma GCC poison bcopy bzero bcmp rindex
  927. /* Poison ENABLE_CHECKING macro that should be replaced with
  928. 'if (flag_checking)', or with CHECKING_P macro. */
  929. #pragma GCC poison ENABLE_CHECKING
  930. #endif /* GCC >= 3.0 */
  931. /* This macro allows casting away const-ness to pass -Wcast-qual
  932. warnings. DO NOT USE THIS UNLESS YOU REALLY HAVE TO! It should
  933. only be used in certain specific cases. One valid case is where
  934. the C standard definitions or prototypes force you to. E.g. if you
  935. need to free a const object, or if you pass a const string to
  936. execv, et al. Another valid use would be in an allocation function
  937. that creates const objects that need to be initialized. In some
  938. cases we have non-const functions that return the argument
  939. (e.g. next_nonnote_insn). Rather than create const shadow
  940. functions, we can cast away const-ness in calling these interfaces
  941. if we're careful to verify that the called function does indeed not
  942. modify its argument and the return value is only used in a const
  943. context. (This can be somewhat dangerous as these assumptions can
  944. change after the fact). Beyond these uses, most other cases of
  945. using this macro should be viewed with extreme caution. */
  946. #ifdef __cplusplus
  947. #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
  948. #else
  949. #if defined(__GNUC__) && GCC_VERSION > 4000
  950. /* GCC 4.0.x has a bug where it may ICE on this expression,
  951. so does GCC 3.4.x (PR17436). */
  952. #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
  953. #elif defined(__GNUC__)
  954. static inline char *
  955. helper_const_non_const_cast (const char *p)
  956. {
  957. union {
  958. const char *const_c;
  959. char *c;
  960. } val;
  961. val.const_c = p;
  962. return val.c;
  963. }
  964. #define CONST_CAST2(TOTYPE,FROMTYPE,X) \
  965. ((TOTYPE) helper_const_non_const_cast ((const char *) (FROMTYPE) (X)))
  966. #else
  967. #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
  968. #endif
  969. #endif
  970. #define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
  971. #define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X))
  972. #define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X))
  973. #define CONST_CAST_RTX_INSN(X) CONST_CAST (struct rtx_insn *, (X))
  974. #define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X))
  975. #define CONST_CAST_GIMPLE(X) CONST_CAST (gimple *, (X))
  976. /* Activate certain diagnostics as warnings (not errors via the
  977. -Werror flag). */
  978. #if GCC_VERSION >= 4003
  979. /* If asserts are disabled, activate -Wuninitialized as a warning (not
  980. an error/-Werror). */
  981. #ifndef ENABLE_ASSERT_CHECKING
  982. #pragma GCC diagnostic warning "-Wuninitialized"
  983. #endif
  984. #endif
  985. #ifdef ENABLE_VALGRIND_ANNOTATIONS
  986. # ifdef HAVE_VALGRIND_MEMCHECK_H
  987. # include <valgrind/memcheck.h>
  988. # elif defined HAVE_MEMCHECK_H
  989. # include <memcheck.h>
  990. # else
  991. # include <valgrind.h>
  992. # endif
  993. /* Compatibility macros to let valgrind 3.1 work. */
  994. # ifndef VALGRIND_MAKE_MEM_NOACCESS
  995. # define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
  996. # endif
  997. # ifndef VALGRIND_MAKE_MEM_DEFINED
  998. # define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
  999. # endif
  1000. # ifndef VALGRIND_MAKE_MEM_UNDEFINED
  1001. # define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
  1002. # endif
  1003. #else
  1004. /* Avoid #ifdef:s when we can help it. */
  1005. #define VALGRIND_DISCARD(x)
  1006. #define VALGRIND_MALLOCLIKE_BLOCK(w,x,y,z)
  1007. #define VALGRIND_FREELIKE_BLOCK(x,y)
  1008. #endif
  1009. /* Macros to temporarily ignore some warnings. */
  1010. #if GCC_VERSION >= 6000
  1011. #define GCC_DIAGNOSTIC_STRINGIFY(x) #x
  1012. #define GCC_DIAGNOSTIC_PUSH_IGNORED(x) \
  1013. _Pragma ("GCC diagnostic push") \
  1014. _Pragma (GCC_DIAGNOSTIC_STRINGIFY (GCC diagnostic ignored #x))
  1015. #define GCC_DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
  1016. #else
  1017. #define GCC_DIAGNOSTIC_PUSH_IGNORED(x)
  1018. #define GCC_DIAGNOSTIC_POP
  1019. #endif
  1020. /* In LTO -fwhole-program build we still want to keep the debug functions available
  1021. for debugger. Mark them as used to prevent removal. */
  1022. #if (GCC_VERSION > 4000)
  1023. #define DEBUG_FUNCTION __attribute__ ((__used__))
  1024. #define DEBUG_VARIABLE __attribute__ ((__used__))
  1025. #else
  1026. #define DEBUG_FUNCTION
  1027. #define DEBUG_VARIABLE
  1028. #endif
  1029. /* General macro to extract bit Y of X. */
  1030. #define TEST_BIT(X, Y) (((X) >> (Y)) & 1)
  1031. /* Get definitions of HOST_WIDE_INT. */
  1032. #include "hwint.h"
  1033. /* GCC qsort API-compatible functions: except in release-checking compilers,
  1034. redirect 4-argument qsort calls to gcc_qsort; keep 1-argument invocations
  1035. corresponding to vec::qsort (cmp): they use C qsort internally anyway. */
  1036. void qsort_chk (void *, size_t, size_t, int (*)(const void *, const void *));
  1037. void gcc_qsort (void *, size_t, size_t, int (*)(const void *, const void *));
  1038. void gcc_stablesort (void *, size_t, size_t,
  1039. int (*)(const void *, const void *));
  1040. #define PP_5th(a1, a2, a3, a4, a5, ...) a5
  1041. #undef qsort
  1042. #define qsort(...) PP_5th (__VA_ARGS__, gcc_qsort, 3, 2, qsort, 0) (__VA_ARGS__)
  1043. #define ONE_K 1024
  1044. #define ONE_M (ONE_K * ONE_K)
  1045. /* Display a number as an integer multiple of either:
  1046. - 1024, if said integer is >= to 10 K (in base 2)
  1047. - 1024 * 1024, if said integer is >= 10 M in (base 2)
  1048. */
  1049. #define SIZE_SCALE(x) (((x) < 10 * ONE_K \
  1050. ? (x) \
  1051. : ((x) < 10 * ONE_M \
  1052. ? (x) / ONE_K \
  1053. : (x) / ONE_M)))
  1054. /* For a given integer, display either:
  1055. - the character 'k', if the number is higher than 10 K (in base 2)
  1056. but strictly lower than 10 M (in base 2)
  1057. - the character 'M' if the number is higher than 10 M (in base2)
  1058. - the charcter ' ' if the number is strictly lower than 10 K */
  1059. #define SIZE_LABEL(x) ((x) < 10 * ONE_K ? ' ' : ((x) < 10 * ONE_M ? 'k' : 'M'))
  1060. /* Display an integer amount as multiple of 1K or 1M (in base 2).
  1061. Display the correct unit (either k, M, or ' ') after the amount, as
  1062. well. */
  1063. #define SIZE_AMOUNT(size) (uint64_t)SIZE_SCALE (size), SIZE_LABEL (size)
  1064. /* Format string particle for printing a SIZE_AMOUNT with N being the width
  1065. of the number. */
  1066. #define PRsa(n) "%" #n PRIu64 "%c"
  1067. #endif /* ! GCC_SYSTEM_H */