system.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106
  1. /* Get common system includes and various definitions and declarations based
  2. on autoconf macros.
  3. Copyright (C) 1998-2015 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. # include <string>
  174. #endif
  175. /* There are an extraordinary number of issues with <ctype.h>.
  176. The last straw is that it varies with the locale. Use libiberty's
  177. replacement instead. */
  178. #include "safe-ctype.h"
  179. #include <sys/types.h>
  180. #include <errno.h>
  181. #if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
  182. extern int errno;
  183. #endif
  184. #ifdef __cplusplus
  185. # include <algorithm>
  186. # include <cstring>
  187. # include <utility>
  188. #endif
  189. /* Some of glibc's string inlines cause warnings. Plus we'd rather
  190. rely on (and therefore test) GCC's string builtins. */
  191. #define __NO_STRING_INLINES
  192. #ifdef STRING_WITH_STRINGS
  193. # include <string.h>
  194. # include <strings.h>
  195. #else
  196. # ifdef HAVE_STRING_H
  197. # include <string.h>
  198. # else
  199. # ifdef HAVE_STRINGS_H
  200. # include <strings.h>
  201. # endif
  202. # endif
  203. #endif
  204. #ifdef HAVE_STDLIB_H
  205. # include <stdlib.h>
  206. #endif
  207. /* When compiling C++ we need to include <cstdlib> as well as <stdlib.h> so
  208. that it is processed before we poison "malloc"; otherwise, if a source
  209. file uses a standard library header that includes <cstdlib>, we will get
  210. an error about 'using std::malloc'. */
  211. #ifdef __cplusplus
  212. #include <cstdlib>
  213. #endif
  214. /* Undef vec_free from AIX stdlib.h header which conflicts with vec.h. */
  215. #undef vec_free
  216. /* If we don't have an overriding definition, set SUCCESS_EXIT_CODE and
  217. FATAL_EXIT_CODE to EXIT_SUCCESS and EXIT_FAILURE respectively,
  218. or 0 and 1 if those macros are not defined. */
  219. #ifndef SUCCESS_EXIT_CODE
  220. # ifdef EXIT_SUCCESS
  221. # define SUCCESS_EXIT_CODE EXIT_SUCCESS
  222. # else
  223. # define SUCCESS_EXIT_CODE 0
  224. # endif
  225. #endif
  226. #ifndef FATAL_EXIT_CODE
  227. # ifdef EXIT_FAILURE
  228. # define FATAL_EXIT_CODE EXIT_FAILURE
  229. # else
  230. # define FATAL_EXIT_CODE 1
  231. # endif
  232. #endif
  233. #define ICE_EXIT_CODE 4
  234. #ifdef HAVE_UNISTD_H
  235. # include <unistd.h>
  236. #endif
  237. #ifdef HAVE_SYS_PARAM_H
  238. # include <sys/param.h>
  239. /* We use these identifiers later and they appear in some vendor param.h's. */
  240. # undef PREFETCH
  241. # undef m_slot
  242. #endif
  243. #if HAVE_LIMITS_H
  244. # include <limits.h>
  245. #endif
  246. /* A macro to determine whether a VALUE lies inclusively within a
  247. certain range without evaluating the VALUE more than once. This
  248. macro won't warn if the VALUE is unsigned and the LOWER bound is
  249. zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER
  250. bound *is* evaluated twice, and LOWER must not be greater than
  251. UPPER. However the bounds themselves can be either positive or
  252. negative. */
  253. #define IN_RANGE(VALUE, LOWER, UPPER) \
  254. ((unsigned HOST_WIDE_INT) (VALUE) - (unsigned HOST_WIDE_INT) (LOWER) \
  255. <= (unsigned HOST_WIDE_INT) (UPPER) - (unsigned HOST_WIDE_INT) (LOWER))
  256. /* Infrastructure for defining missing _MAX and _MIN macros. Note that
  257. macros defined with these cannot be used in #if. */
  258. /* The extra casts work around common compiler bugs. */
  259. #define INTTYPE_SIGNED(t) (! ((t) 0 < (t) -1))
  260. /* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
  261. It is necessary at least when t == time_t. */
  262. #define INTTYPE_MINIMUM(t) ((t) (INTTYPE_SIGNED (t) \
  263. ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
  264. #define INTTYPE_MAXIMUM(t) ((t) (~ (t) 0 - INTTYPE_MINIMUM (t)))
  265. /* Use that infrastructure to provide a few constants. */
  266. #ifndef UCHAR_MAX
  267. # define UCHAR_MAX INTTYPE_MAXIMUM (unsigned char)
  268. #endif
  269. #ifdef TIME_WITH_SYS_TIME
  270. # include <sys/time.h>
  271. # include <time.h>
  272. #else
  273. # if HAVE_SYS_TIME_H
  274. # include <sys/time.h>
  275. # else
  276. # ifdef HAVE_TIME_H
  277. # include <time.h>
  278. # endif
  279. # endif
  280. #endif
  281. #ifdef HAVE_FCNTL_H
  282. # include <fcntl.h>
  283. #else
  284. # ifdef HAVE_SYS_FILE_H
  285. # include <sys/file.h>
  286. # endif
  287. #endif
  288. #ifndef SEEK_SET
  289. # define SEEK_SET 0
  290. # define SEEK_CUR 1
  291. # define SEEK_END 2
  292. #endif
  293. #ifndef F_OK
  294. # define F_OK 0
  295. # define X_OK 1
  296. # define W_OK 2
  297. # define R_OK 4
  298. #endif
  299. #ifndef O_RDONLY
  300. # define O_RDONLY 0
  301. #endif
  302. #ifndef O_WRONLY
  303. # define O_WRONLY 1
  304. #endif
  305. #ifndef O_BINARY
  306. # define O_BINARY 0
  307. #endif
  308. /* Some systems define these in, e.g., param.h. We undefine these names
  309. here to avoid the warnings. We prefer to use our definitions since we
  310. know they are correct. */
  311. #undef MIN
  312. #undef MAX
  313. #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
  314. #define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
  315. /* Returns the least number N such that N * Y >= X. */
  316. #define CEIL(x,y) (((x) + (y) - 1) / (y))
  317. #ifdef HAVE_SYS_WAIT_H
  318. #include <sys/wait.h>
  319. #endif
  320. #ifndef WIFSIGNALED
  321. #define WIFSIGNALED(S) (((S) & 0xff) != 0 && ((S) & 0xff) != 0x7f)
  322. #endif
  323. #ifndef WTERMSIG
  324. #define WTERMSIG(S) ((S) & 0x7f)
  325. #endif
  326. #ifndef WIFEXITED
  327. #define WIFEXITED(S) (((S) & 0xff) == 0)
  328. #endif
  329. #ifndef WEXITSTATUS
  330. #define WEXITSTATUS(S) (((S) & 0xff00) >> 8)
  331. #endif
  332. #ifndef WSTOPSIG
  333. #define WSTOPSIG WEXITSTATUS
  334. #endif
  335. #ifndef WCOREDUMP
  336. #define WCOREDUMP(S) ((S) & WCOREFLG)
  337. #endif
  338. #ifndef WCOREFLG
  339. #define WCOREFLG 0200
  340. #endif
  341. #include <signal.h>
  342. #if !defined (SIGCHLD) && defined (SIGCLD)
  343. # define SIGCHLD SIGCLD
  344. #endif
  345. #ifdef HAVE_SYS_MMAN_H
  346. # include <sys/mman.h>
  347. #endif
  348. #ifndef MAP_FAILED
  349. # define MAP_FAILED ((void *)-1)
  350. #endif
  351. #if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
  352. # define MAP_ANONYMOUS MAP_ANON
  353. #endif
  354. #ifdef HAVE_SYS_RESOURCE_H
  355. # include <sys/resource.h>
  356. #endif
  357. #ifdef HAVE_SYS_TIMES_H
  358. # include <sys/times.h>
  359. #endif
  360. /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
  361. are defined to 0 then we must provide the relevant declaration
  362. here. These checks will be in the undefined state while configure
  363. is running so be careful to test "defined (HAVE_DECL_*)". */
  364. #ifdef __cplusplus
  365. extern "C" {
  366. #endif
  367. #if defined (HAVE_DECL_ATOF) && !HAVE_DECL_ATOF
  368. extern double atof (const char *);
  369. #endif
  370. #if defined (HAVE_DECL_ATOL) && !HAVE_DECL_ATOL
  371. extern long atol (const char *);
  372. #endif
  373. #if defined (HAVE_DECL_FREE) && !HAVE_DECL_FREE
  374. extern void free (void *);
  375. #endif
  376. #if defined (HAVE_DECL_GETCWD) && !HAVE_DECL_GETCWD
  377. extern char *getcwd (char *, size_t);
  378. #endif
  379. #if defined (HAVE_DECL_GETENV) && !HAVE_DECL_GETENV
  380. extern char *getenv (const char *);
  381. #endif
  382. #if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT
  383. extern int getopt (int, char * const *, const char *);
  384. #endif
  385. #if defined (HAVE_DECL_GETPAGESIZE) && !HAVE_DECL_GETPAGESIZE
  386. extern int getpagesize (void);
  387. #endif
  388. #if defined (HAVE_DECL_GETWD) && !HAVE_DECL_GETWD
  389. extern char *getwd (char *);
  390. #endif
  391. #if defined (HAVE_DECL_SBRK) && !HAVE_DECL_SBRK
  392. extern void *sbrk (int);
  393. #endif
  394. #if defined (HAVE_DECL_STRSTR) && !HAVE_DECL_STRSTR
  395. extern char *strstr (const char *, const char *);
  396. #endif
  397. #if defined (HAVE_DECL_STPCPY) && !HAVE_DECL_STPCPY
  398. extern char *stpcpy (char *, const char *);
  399. #endif
  400. #ifdef __cplusplus
  401. }
  402. #endif
  403. #ifdef HAVE_MALLOC_H
  404. #include <malloc.h>
  405. #endif
  406. #ifdef __cplusplus
  407. extern "C" {
  408. #endif
  409. #if defined (HAVE_DECL_MALLOC) && !HAVE_DECL_MALLOC
  410. extern void *malloc (size_t);
  411. #endif
  412. #if defined (HAVE_DECL_CALLOC) && !HAVE_DECL_CALLOC
  413. extern void *calloc (size_t, size_t);
  414. #endif
  415. #if defined (HAVE_DECL_REALLOC) && !HAVE_DECL_REALLOC
  416. extern void *realloc (void *, size_t);
  417. #endif
  418. #ifdef __cplusplus
  419. }
  420. #endif
  421. #ifdef HAVE_STDINT_H
  422. #include <stdint.h>
  423. #endif
  424. #ifdef HAVE_INTTYPES_H
  425. #include <inttypes.h>
  426. #endif
  427. #ifdef __cplusplus
  428. extern "C" {
  429. #endif
  430. /* If the system doesn't provide strsignal, we get it defined in
  431. libiberty but no declaration is supplied. */
  432. #if !defined (HAVE_STRSIGNAL) \
  433. || (defined (HAVE_DECL_STRSIGNAL) && !HAVE_DECL_STRSIGNAL)
  434. # ifndef strsignal
  435. extern const char *strsignal (int);
  436. # endif
  437. #endif
  438. #ifdef HAVE_GETRLIMIT
  439. # if defined (HAVE_DECL_GETRLIMIT) && !HAVE_DECL_GETRLIMIT
  440. # ifndef getrlimit
  441. struct rlimit;
  442. extern int getrlimit (int, struct rlimit *);
  443. # endif
  444. # endif
  445. #endif
  446. #ifdef HAVE_SETRLIMIT
  447. # if defined (HAVE_DECL_SETRLIMIT) && !HAVE_DECL_SETRLIMIT
  448. # ifndef setrlimit
  449. struct rlimit;
  450. extern int setrlimit (int, const struct rlimit *);
  451. # endif
  452. # endif
  453. #endif
  454. #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
  455. extern void abort (void);
  456. #endif
  457. #if defined (HAVE_DECL_SNPRINTF) && !HAVE_DECL_SNPRINTF
  458. extern int snprintf (char *, size_t, const char *, ...);
  459. #endif
  460. #if defined (HAVE_DECL_VSNPRINTF) && !HAVE_DECL_VSNPRINTF
  461. extern int vsnprintf (char *, size_t, const char *, va_list);
  462. #endif
  463. #ifdef __cplusplus
  464. }
  465. #endif
  466. /* 1 if we have C99 designated initializers. */
  467. #if !defined(HAVE_DESIGNATED_INITIALIZERS)
  468. #define HAVE_DESIGNATED_INITIALIZERS \
  469. (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) \
  470. && !defined(__cplusplus))
  471. #endif
  472. #if !defined(HAVE_DESIGNATED_UNION_INITIALIZERS)
  473. #define HAVE_DESIGNATED_UNION_INITIALIZERS \
  474. (((GCC_VERSION >= 2007) || (__STDC_VERSION__ >= 199901L)) \
  475. && (!defined(__cplusplus) || (GCC_VERSION >= 4007)))
  476. #endif
  477. #if HAVE_SYS_STAT_H
  478. # include <sys/stat.h>
  479. #endif
  480. /* Test if something is a normal file. */
  481. #ifndef S_ISREG
  482. #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
  483. #endif
  484. /* Test if something is a directory. */
  485. #ifndef S_ISDIR
  486. #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
  487. #endif
  488. /* Test if something is a character special file. */
  489. #ifndef S_ISCHR
  490. #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
  491. #endif
  492. /* Test if something is a block special file. */
  493. #ifndef S_ISBLK
  494. #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
  495. #endif
  496. /* Test if something is a socket. */
  497. #ifndef S_ISSOCK
  498. # ifdef S_IFSOCK
  499. # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
  500. # else
  501. # define S_ISSOCK(m) 0
  502. # endif
  503. #endif
  504. /* Test if something is a FIFO. */
  505. #ifndef S_ISFIFO
  506. # ifdef S_IFIFO
  507. # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
  508. # else
  509. # define S_ISFIFO(m) 0
  510. # endif
  511. #endif
  512. /* Define well known filenos if the system does not define them. */
  513. #ifndef STDIN_FILENO
  514. # define STDIN_FILENO 0
  515. #endif
  516. #ifndef STDOUT_FILENO
  517. # define STDOUT_FILENO 1
  518. #endif
  519. #ifndef STDERR_FILENO
  520. # define STDERR_FILENO 2
  521. #endif
  522. /* Some systems have mkdir that takes a single argument. */
  523. #ifdef MKDIR_TAKES_ONE_ARG
  524. # define mkdir(a,b) mkdir (a)
  525. #endif
  526. #ifndef HAVE_KILL
  527. # define kill(p,s) raise (s)
  528. #endif
  529. /* Provide a way to print an address via printf. */
  530. #ifndef HOST_PTR_PRINTF
  531. #define HOST_PTR_PRINTF "%p"
  532. #endif /* ! HOST_PTR_PRINTF */
  533. /* By default, colon separates directories in a path. */
  534. #ifndef PATH_SEPARATOR
  535. #define PATH_SEPARATOR ':'
  536. #endif
  537. /* Filename handling macros. */
  538. #include "filenames.h"
  539. /* These should be phased out in favor of IS_DIR_SEPARATOR, where possible. */
  540. #ifndef DIR_SEPARATOR
  541. # define DIR_SEPARATOR '/'
  542. # ifdef HAVE_DOS_BASED_FILE_SYSTEM
  543. # define DIR_SEPARATOR_2 '\\'
  544. # endif
  545. #endif
  546. #if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H)
  547. /* If plugin support is enabled, we could use libdl. */
  548. #include <dlfcn.h>
  549. #endif
  550. /* Do not introduce a gmp.h dependency on the build system. */
  551. #ifndef GENERATOR_FILE
  552. #include <gmp.h>
  553. #endif
  554. /* Get libiberty declarations. */
  555. #include "libiberty.h"
  556. #undef FFS /* Some systems predefine this symbol; don't let it interfere. */
  557. #undef FLOAT /* Likewise. */
  558. #undef ABS /* Likewise. */
  559. #undef PC /* Likewise. */
  560. /* Provide a default for the HOST_BIT_BUCKET.
  561. This suffices for POSIX-like hosts. */
  562. #ifndef HOST_BIT_BUCKET
  563. #define HOST_BIT_BUCKET "/dev/null"
  564. #endif
  565. #ifndef offsetof
  566. #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
  567. #endif
  568. /* Various error reporting routines want to use __FUNCTION__. */
  569. #if (GCC_VERSION < 2007)
  570. #ifndef __FUNCTION__
  571. #define __FUNCTION__ "?"
  572. #endif /* ! __FUNCTION__ */
  573. #endif
  574. /* __builtin_expect(A, B) evaluates to A, but notifies the compiler that
  575. the most likely value of A is B. This feature was added at some point
  576. between 2.95 and 3.0. Let's use 3.0 as the lower bound for now. */
  577. #if (GCC_VERSION < 3000)
  578. #define __builtin_expect(a, b) (a)
  579. #endif
  580. /* Redefine abort to report an internal error w/o coredump, and
  581. reporting the location of the error in the source file. */
  582. extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
  583. #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
  584. /* Use gcc_assert(EXPR) to test invariants. */
  585. #if ENABLE_ASSERT_CHECKING
  586. #define gcc_assert(EXPR) \
  587. ((void)(!(EXPR) ? fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0 : 0))
  588. #elif (GCC_VERSION >= 4005)
  589. #define gcc_assert(EXPR) \
  590. ((void)(__builtin_expect (!(EXPR), 0) ? __builtin_unreachable (), 0 : 0))
  591. #else
  592. /* Include EXPR, so that unused variable warnings do not occur. */
  593. #define gcc_assert(EXPR) ((void)(0 && (EXPR)))
  594. #endif
  595. #ifdef ENABLE_CHECKING
  596. #define gcc_checking_assert(EXPR) gcc_assert (EXPR)
  597. #else
  598. #define gcc_checking_assert(EXPR) ((void)(0 && (EXPR)))
  599. #endif
  600. /* Use gcc_unreachable() to mark unreachable locations (like an
  601. unreachable default case of a switch. Do not use gcc_assert(0). */
  602. #if (GCC_VERSION >= 4005) && !ENABLE_ASSERT_CHECKING
  603. #define gcc_unreachable() __builtin_unreachable ()
  604. #else
  605. #define gcc_unreachable() (fancy_abort (__FILE__, __LINE__, __FUNCTION__))
  606. #endif
  607. #if GCC_VERSION >= 3001
  608. #define STATIC_CONSTANT_P(X) (__builtin_constant_p (X) && (X))
  609. #else
  610. #define STATIC_CONSTANT_P(X) (false && (X))
  611. #endif
  612. /* Until we can use C++11's static_assert. */
  613. #define STATIC_ASSERT(X) \
  614. typedef int assertion1[(X) ? 1 : -1] ATTRIBUTE_UNUSED
  615. /* Provide a fake boolean type. We make no attempt to use the
  616. C99 _Bool, as it may not be available in the bootstrap compiler,
  617. and even if it is, it is liable to be buggy.
  618. This must be after all inclusion of system headers, as some of
  619. them will mess us up. */
  620. #undef TRUE
  621. #undef FALSE
  622. #ifdef __cplusplus
  623. /* Obsolete. */
  624. # define TRUE true
  625. # define FALSE false
  626. #else /* !__cplusplus */
  627. # undef bool
  628. # undef true
  629. # undef false
  630. # define bool unsigned char
  631. # define true 1
  632. # define false 0
  633. /* Obsolete. */
  634. # define TRUE true
  635. # define FALSE false
  636. #endif /* !__cplusplus */
  637. /* Some compilers do not allow the use of unsigned char in bitfields. */
  638. #define BOOL_BITFIELD unsigned int
  639. /* As the last action in this file, we poison the identifiers that
  640. shouldn't be used. Note, luckily gcc-3.0's token-based integrated
  641. preprocessor won't trip on poisoned identifiers that arrive from
  642. the expansion of macros. E.g. #define strrchr rindex, won't error
  643. if rindex is poisoned after this directive is issued and later on
  644. strrchr is called.
  645. Note: We define bypass macros for the few cases where we really
  646. want to use the libc memory allocation routines. Otherwise we
  647. insist you use the "x" versions from libiberty. */
  648. #define really_call_malloc malloc
  649. #define really_call_calloc calloc
  650. #define really_call_realloc realloc
  651. #if defined(FLEX_SCANNER) || defined(YYBISON) || defined(YYBYACC)
  652. /* Flex and bison use malloc and realloc. Yuk. Note that this means
  653. really_call_* cannot be used in a .l or .y file. */
  654. #define malloc xmalloc
  655. #define realloc xrealloc
  656. #endif
  657. #if (GCC_VERSION >= 3000)
  658. /* Note autoconf checks for prototype declarations and includes
  659. system.h while doing so. Only poison these tokens if actually
  660. compiling gcc, so that the autoconf declaration tests for malloc
  661. etc don't spuriously fail. */
  662. #ifdef IN_GCC
  663. #undef calloc
  664. #undef strdup
  665. #pragma GCC poison calloc strdup
  666. #if !defined(FLEX_SCANNER) && !defined(YYBISON)
  667. #undef malloc
  668. #undef realloc
  669. #pragma GCC poison malloc realloc
  670. #endif
  671. /* The %m format should be used when GCC's main diagnostic functions
  672. supporting %m are available, and xstrerror from libiberty
  673. otherwise. */
  674. #undef strerror
  675. #pragma GCC poison strerror
  676. /* loc_t is defined on some systems and too inviting for some
  677. programmers to avoid. */
  678. #undef loc_t
  679. #pragma GCC poison loc_t
  680. /* Old target macros that have moved to the target hooks structure. */
  681. #pragma GCC poison ASM_OPEN_PAREN ASM_CLOSE_PAREN \
  682. FUNCTION_PROLOGUE FUNCTION_EPILOGUE \
  683. FUNCTION_END_PROLOGUE FUNCTION_BEGIN_EPILOGUE \
  684. DECL_MACHINE_ATTRIBUTES COMP_TYPE_ATTRIBUTES INSERT_ATTRIBUTES \
  685. VALID_MACHINE_DECL_ATTRIBUTE VALID_MACHINE_TYPE_ATTRIBUTE \
  686. SET_DEFAULT_TYPE_ATTRIBUTES SET_DEFAULT_DECL_ATTRIBUTES \
  687. MERGE_MACHINE_TYPE_ATTRIBUTES MERGE_MACHINE_DECL_ATTRIBUTES \
  688. MD_INIT_BUILTINS MD_EXPAND_BUILTIN ASM_OUTPUT_CONSTRUCTOR \
  689. ASM_OUTPUT_DESTRUCTOR SIGNED_CHAR_SPEC MAX_CHAR_TYPE_SIZE \
  690. WCHAR_UNSIGNED UNIQUE_SECTION SELECT_SECTION SELECT_RTX_SECTION \
  691. ENCODE_SECTION_INFO STRIP_NAME_ENCODING ASM_GLOBALIZE_LABEL \
  692. ASM_OUTPUT_MI_THUNK CONST_COSTS RTX_COSTS DEFAULT_RTX_COSTS \
  693. ADDRESS_COST MACHINE_DEPENDENT_REORG ASM_FILE_START ASM_FILE_END \
  694. ASM_SIMPLIFY_DWARF_ADDR INIT_TARGET_OPTABS INIT_SUBTARGET_OPTABS \
  695. INIT_GOFAST_OPTABS MULSI3_LIBCALL MULDI3_LIBCALL DIVSI3_LIBCALL \
  696. DIVDI3_LIBCALL UDIVSI3_LIBCALL UDIVDI3_LIBCALL MODSI3_LIBCALL \
  697. MODDI3_LIBCALL UMODSI3_LIBCALL UMODDI3_LIBCALL BUILD_VA_LIST_TYPE \
  698. PRETEND_OUTGOING_VARARGS_NAMED STRUCT_VALUE_INCOMING_REGNUM \
  699. ASM_OUTPUT_SECTION_NAME PROMOTE_FUNCTION_ARGS PROMOTE_FUNCTION_MODE \
  700. STRUCT_VALUE_INCOMING STRICT_ARGUMENT_NAMING \
  701. PROMOTE_FUNCTION_RETURN PROMOTE_PROTOTYPES STRUCT_VALUE_REGNUM \
  702. SETUP_INCOMING_VARARGS EXPAND_BUILTIN_SAVEREGS \
  703. DEFAULT_SHORT_ENUMS SPLIT_COMPLEX_ARGS MD_ASM_CLOBBERS \
  704. HANDLE_PRAGMA_REDEFINE_EXTNAME HANDLE_PRAGMA_EXTERN_PREFIX \
  705. MUST_PASS_IN_STACK FUNCTION_ARG_PASS_BY_REFERENCE \
  706. VECTOR_MODE_SUPPORTED_P TARGET_SUPPORTS_HIDDEN \
  707. FUNCTION_ARG_PARTIAL_NREGS ASM_OUTPUT_DWARF_DTPREL \
  708. ALLOCATE_INITIAL_VALUE LEGITIMIZE_ADDRESS FRAME_POINTER_REQUIRED \
  709. CAN_ELIMINATE TRAMPOLINE_TEMPLATE INITIALIZE_TRAMPOLINE \
  710. TRAMPOLINE_ADJUST_ADDRESS STATIC_CHAIN STATIC_CHAIN_INCOMING \
  711. RETURN_POPS_ARGS UNITS_PER_SIMD_WORD OVERRIDE_OPTIONS \
  712. OPTIMIZATION_OPTIONS CLASS_LIKELY_SPILLED_P \
  713. USING_SJLJ_EXCEPTIONS TARGET_UNWIND_INFO \
  714. LABEL_ALIGN_MAX_SKIP LOOP_ALIGN_MAX_SKIP \
  715. LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP JUMP_ALIGN_MAX_SKIP \
  716. CAN_DEBUG_WITHOUT_FP UNLIKELY_EXECUTED_TEXT_SECTION_NAME \
  717. HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P ALWAYS_STRIP_DOTDOT \
  718. OUTPUT_ADDR_CONST_EXTRA SMALL_REGISTER_CLASSES ASM_OUTPUT_IDENT \
  719. ASM_BYTE_OP MEMBER_TYPE_FORCES_BLK LIBGCC2_HAS_SF_MODE \
  720. LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE \
  721. CLEAR_BY_PIECES_P MOVE_BY_PIECES_P SET_BY_PIECES_P \
  722. STORE_BY_PIECES_P
  723. /* Target macros only used for code built for the target, that have
  724. moved to libgcc-tm.h or have never been present elsewhere. */
  725. #pragma GCC poison DECLARE_LIBRARY_RENAMES LIBGCC2_GNU_PREFIX \
  726. MD_UNWIND_SUPPORT MD_FROB_UPDATE_CONTEXT ENABLE_EXECUTE_STACK \
  727. REG_VALUE_IN_UNWIND_CONTEXT ASSUME_EXTENDED_UNWIND_CONTEXT
  728. /* Other obsolete target macros, or macros that used to be in target
  729. headers and were not used, and may be obsolete or may never have
  730. been used. */
  731. #pragma GCC poison INT_ASM_OP ASM_OUTPUT_EH_REGION_BEG CPP_PREDEFINES \
  732. ASM_OUTPUT_EH_REGION_END ASM_OUTPUT_LABELREF_AS_INT SMALL_STACK \
  733. DOESNT_NEED_UNWINDER EH_TABLE_LOOKUP OBJC_SELECTORS_WITHOUT_LABELS \
  734. OMIT_EH_TABLE EASY_DIV_EXPR IMPLICIT_FIX_EXPR \
  735. LONGJMP_RESTORE_FROM_STACK MAX_INT_TYPE_SIZE ASM_IDENTIFY_GCC \
  736. STDC_VALUE TRAMPOLINE_ALIGN ASM_IDENTIFY_GCC_AFTER_SOURCE \
  737. SLOW_ZERO_EXTEND SUBREG_REGNO_OFFSET DWARF_LINE_MIN_INSTR_LENGTH \
  738. TRADITIONAL_RETURN_FLOAT NO_BUILTIN_SIZE_TYPE \
  739. NO_BUILTIN_PTRDIFF_TYPE NO_BUILTIN_WCHAR_TYPE NO_BUILTIN_WINT_TYPE \
  740. BLOCK_PROFILER BLOCK_PROFILER_CODE FUNCTION_BLOCK_PROFILER \
  741. FUNCTION_BLOCK_PROFILER_EXIT MACHINE_STATE_SAVE \
  742. MACHINE_STATE_RESTORE SCCS_DIRECTIVE SECTION_ASM_OP BYTEORDER \
  743. ASM_OUTPUT_DEFINE_LABEL_DIFFERENCE_SYMBOL HOST_WORDS_BIG_ENDIAN \
  744. OBJC_PROLOGUE ALLOCATE_TRAMPOLINE HANDLE_PRAGMA ROUND_TYPE_SIZE \
  745. ROUND_TYPE_SIZE_UNIT CONST_SECTION_ASM_OP CRT_GET_RFIB_TEXT \
  746. DBX_LBRAC_FIRST DBX_OUTPUT_ENUM DBX_OUTPUT_SOURCE_FILENAME \
  747. DBX_WORKING_DIRECTORY INSN_CACHE_DEPTH INSN_CACHE_SIZE \
  748. INSN_CACHE_LINE_WIDTH INIT_SECTION_PREAMBLE NEED_ATEXIT ON_EXIT \
  749. EXIT_BODY OBJECT_FORMAT_ROSE MULTIBYTE_CHARS MAP_CHARACTER \
  750. LIBGCC_NEEDS_DOUBLE FINAL_PRESCAN_LABEL DEFAULT_CALLER_SAVES \
  751. LOAD_ARGS_REVERSED MAX_INTEGER_COMPUTATION_MODE \
  752. CONVERT_HARD_REGISTER_TO_SSA_P ASM_OUTPUT_MAIN_SOURCE_FILENAME \
  753. FIRST_INSN_ADDRESS TEXT_SECTION SHARED_BSS_SECTION_ASM_OP \
  754. PROMOTED_MODE EXPAND_BUILTIN_VA_END \
  755. LINKER_DOES_NOT_WORK_WITH_DWARF2 FUNCTION_ARG_KEEP_AS_REFERENCE \
  756. GIV_SORT_CRITERION MAX_LONG_TYPE_SIZE MAX_LONG_DOUBLE_TYPE_SIZE \
  757. MAX_WCHAR_TYPE_SIZE SHARED_SECTION_ASM_OP INTEGRATE_THRESHOLD \
  758. FINAL_REG_PARM_STACK_SPACE MAYBE_REG_PARM_STACK_SPACE \
  759. TRADITIONAL_PIPELINE_INTERFACE DFA_PIPELINE_INTERFACE \
  760. DBX_OUTPUT_STANDARD_TYPES BUILTIN_SETJMP_FRAME_VALUE \
  761. SUNOS4_SHARED_LIBRARIES PROMOTE_FOR_CALL_ONLY \
  762. SPACE_AFTER_L_OPTION NO_RECURSIVE_FUNCTION_CSE \
  763. DEFAULT_MAIN_RETURN TARGET_MEM_FUNCTIONS EXPAND_BUILTIN_VA_ARG \
  764. COLLECT_PARSE_FLAG DWARF2_GENERATE_TEXT_SECTION_LABEL WINNING_GDB \
  765. ASM_OUTPUT_FILENAME ASM_OUTPUT_SOURCE_LINE FILE_NAME_JOINER \
  766. GDB_INV_REF_REGPARM_STABS_LETTER DBX_MEMPARM_STABS_LETTER \
  767. PUT_SDB_SRC_FILE STABS_GCC_MARKER DBX_OUTPUT_FUNCTION_END \
  768. DBX_OUTPUT_GCC_MARKER DBX_FINISH_SYMBOL SDB_GENERATE_FAKE \
  769. NON_SAVING_SETJMP TARGET_LATE_RTL_PROLOGUE_EPILOGUE \
  770. CASE_DROPS_THROUGH TARGET_BELL TARGET_BS TARGET_CR TARGET_DIGIT0 \
  771. TARGET_ESC TARGET_FF TARGET_NEWLINE TARGET_TAB TARGET_VT \
  772. LINK_LIBGCC_SPECIAL DONT_ACCESS_GBLS_AFTER_EPILOGUE \
  773. TARGET_OPTIONS TARGET_SWITCHES EXTRA_CC_MODES FINALIZE_PIC \
  774. PREDICATE_CODES SPECIAL_MODE_PREDICATES UNALIGNED_WORD_ASM_OP \
  775. EXTRA_SECTIONS EXTRA_SECTION_FUNCTIONS READONLY_DATA_SECTION \
  776. TARGET_ASM_EXCEPTION_SECTION TARGET_ASM_EH_FRAME_SECTION \
  777. SMALL_ARG_MAX ASM_OUTPUT_SHARED_BSS ASM_OUTPUT_SHARED_COMMON \
  778. ASM_OUTPUT_SHARED_LOCAL ASM_MAKE_LABEL_LINKONCE \
  779. STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \
  780. ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \
  781. ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES \
  782. SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG WORD_SWITCH_TAKES_ARG \
  783. TARGET_OPTION_TRANSLATE_TABLE HANDLE_PRAGMA_PACK_PUSH_POP \
  784. HANDLE_SYSV_PRAGMA HANDLE_PRAGMA_WEAK CONDITIONAL_REGISTER_USAGE \
  785. FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST \
  786. USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE \
  787. FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION \
  788. MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS \
  789. SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES \
  790. PREFERRED_OUTPUT_RELOAD_CLASS SYSTEM_INCLUDE_DIR \
  791. STANDARD_INCLUDE_DIR STANDARD_INCLUDE_COMPONENT \
  792. LINK_ELIMINATE_DUPLICATE_LDIRECTORIES MIPS_DEBUGGING_INFO \
  793. IDENT_ASM_OP ALL_COP_ADDITIONAL_REGISTER_NAMES DBX_OUTPUT_LBRAC \
  794. DBX_OUTPUT_NFUN DBX_OUTPUT_RBRAC RANGE_TEST_NON_SHORT_CIRCUIT \
  795. REAL_VALUE_TRUNCATE REVERSE_CONDEXEC_PREDICATES_P \
  796. TARGET_ALIGN_ANON_BITFIELDS TARGET_NARROW_VOLATILE_BITFIELDS \
  797. IDENT_ASM_OP UNALIGNED_SHORT_ASM_OP UNALIGNED_INT_ASM_OP \
  798. UNALIGNED_LONG_ASM_OP UNALIGNED_DOUBLE_INT_ASM_OP \
  799. USE_COMMON_FOR_ONE_ONLY IFCVT_EXTRA_FIELDS IFCVT_INIT_EXTRA_FIELDS \
  800. CASE_USE_BIT_TESTS FIXUNS_TRUNC_LIKE_FIX_TRUNC \
  801. GO_IF_MODE_DEPENDENT_ADDRESS DELAY_SLOTS_FOR_EPILOGUE \
  802. ELIGIBLE_FOR_EPILOGUE_DELAY TARGET_C99_FUNCTIONS TARGET_HAS_SINCOS \
  803. REG_CLASS_FROM_LETTER CONST_OK_FOR_LETTER_P \
  804. CONST_DOUBLE_OK_FOR_LETTER_P EXTRA_CONSTRAINT \
  805. REG_CLASS_FROM_CONSTRAINT REG_CLASS_FOR_CONSTRAINT \
  806. EXTRA_CONSTRAINT_STR EXTRA_MEMORY_CONSTRAINT \
  807. EXTRA_ADDRESS_CONSTRAINT CONST_DOUBLE_OK_FOR_CONSTRAINT_P \
  808. CALLER_SAVE_PROFITABLE LARGEST_EXPONENT_IS_NORMAL \
  809. ROUND_TOWARDS_ZERO SF_SIZE DF_SIZE XF_SIZE TF_SIZE LIBGCC2_TF_CEXT \
  810. LIBGCC2_LONG_DOUBLE_TYPE_SIZE
  811. /* Hooks that are no longer used. */
  812. #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \
  813. LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES \
  814. LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS \
  815. LANG_HOOKS_PUSHLEVEL LANG_HOOKS_SET_BLOCK \
  816. LANG_HOOKS_MAYBE_BUILD_CLEANUP LANG_HOOKS_UPDATE_DECL_AFTER_SAVING \
  817. LANG_HOOKS_POPLEVEL LANG_HOOKS_TRUTHVALUE_CONVERSION \
  818. TARGET_PROMOTE_FUNCTION_ARGS TARGET_PROMOTE_FUNCTION_RETURN \
  819. LANG_HOOKS_MISSING_ARGUMENT LANG_HOOKS_HASH_TYPES \
  820. TARGET_HANDLE_OFAST TARGET_OPTION_OPTIMIZATION \
  821. TARGET_IRA_COVER_CLASSES TARGET_HELP \
  822. TARGET_HANDLE_PRAGMA_EXTERN_PREFIX \
  823. TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_EVEN \
  824. TARGET_VECTORIZE_BUILTIN_MUL_WIDEN_ODD \
  825. /* Arrays that were deleted in favor of a functional interface. */
  826. #pragma GCC poison built_in_decls implicit_built_in_decls
  827. /* Hooks into libgcc2. */
  828. #pragma GCC poison LIBGCC2_DOUBLE_TYPE_SIZE LIBGCC2_WORDS_BIG_ENDIAN \
  829. LIBGCC2_FLOAT_WORDS_BIG_ENDIAN
  830. /* Miscellaneous macros that are no longer used. */
  831. #pragma GCC poison USE_MAPPED_LOCATION GET_ENVIRONMENT
  832. /* Libiberty macros that are no longer used in GCC. */
  833. #undef ANSI_PROTOTYPES
  834. #undef PTR_CONST
  835. #undef LONG_DOUBLE
  836. #undef VPARAMS
  837. #undef VA_OPEN
  838. #undef VA_FIXEDARG
  839. #undef VA_CLOSE
  840. #undef VA_START
  841. #pragma GCC poison ANSI_PROTOTYPES PTR_CONST LONG_DOUBLE VPARAMS VA_OPEN \
  842. VA_FIXEDARG VA_CLOSE VA_START
  843. #endif /* IN_GCC */
  844. /* Front ends should never have to include middle-end headers. Enforce
  845. this by poisoning the header double-include protection defines. */
  846. #ifdef IN_GCC_FRONTEND
  847. #pragma GCC poison GCC_RTL_H GCC_EXCEPT_H GCC_EXPR_H
  848. #endif
  849. /* Note: not all uses of the `index' token (e.g. variable names and
  850. structure members) have been eliminated. */
  851. #undef bcopy
  852. #undef bzero
  853. #undef bcmp
  854. #undef rindex
  855. #pragma GCC poison bcopy bzero bcmp rindex
  856. #endif /* GCC >= 3.0 */
  857. /* This macro allows casting away const-ness to pass -Wcast-qual
  858. warnings. DO NOT USE THIS UNLESS YOU REALLY HAVE TO! It should
  859. only be used in certain specific cases. One valid case is where
  860. the C standard definitions or prototypes force you to. E.g. if you
  861. need to free a const object, or if you pass a const string to
  862. execv, et al. Another valid use would be in an allocation function
  863. that creates const objects that need to be initialized. In some
  864. cases we have non-const functions that return the argument
  865. (e.g. next_nonnote_insn). Rather than create const shadow
  866. functions, we can cast away const-ness in calling these interfaces
  867. if we're careful to verify that the called function does indeed not
  868. modify its argument and the return value is only used in a const
  869. context. (This can be somewhat dangerous as these assumptions can
  870. change after the fact). Beyond these uses, most other cases of
  871. using this macro should be viewed with extreme caution. */
  872. #ifdef __cplusplus
  873. #define CONST_CAST2(TOTYPE,FROMTYPE,X) (const_cast<TOTYPE> (X))
  874. #else
  875. #if defined(__GNUC__) && GCC_VERSION > 4000
  876. /* GCC 4.0.x has a bug where it may ICE on this expression,
  877. so does GCC 3.4.x (PR17436). */
  878. #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((__extension__(union {FROMTYPE _q; TOTYPE _nq;})(X))._nq)
  879. #elif defined(__GNUC__)
  880. static inline char *
  881. helper_const_non_const_cast (const char *p)
  882. {
  883. union {
  884. const char *const_c;
  885. char *c;
  886. } val;
  887. val.const_c = p;
  888. return val.c;
  889. }
  890. #define CONST_CAST2(TOTYPE,FROMTYPE,X) \
  891. ((TOTYPE) helper_const_non_const_cast ((const char *) (FROMTYPE) (X)))
  892. #else
  893. #define CONST_CAST2(TOTYPE,FROMTYPE,X) ((TOTYPE)(FROMTYPE)(X))
  894. #endif
  895. #endif
  896. #define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
  897. #define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X))
  898. #define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X))
  899. #define CONST_CAST_RTX_INSN(X) CONST_CAST (struct rtx_insn *, (X))
  900. #define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X))
  901. #define CONST_CAST_GIMPLE(X) CONST_CAST (struct gimple_statement_base *, (X))
  902. /* Activate certain diagnostics as warnings (not errors via the
  903. -Werror flag). */
  904. #if GCC_VERSION >= 4003
  905. /* If asserts are disabled, activate -Wuninitialized as a warning (not
  906. an error/-Werror). */
  907. #ifndef ENABLE_ASSERT_CHECKING
  908. #pragma GCC diagnostic warning "-Wuninitialized"
  909. #endif
  910. #endif
  911. #ifdef ENABLE_VALGRIND_ANNOTATIONS
  912. # ifdef HAVE_VALGRIND_MEMCHECK_H
  913. # include <valgrind/memcheck.h>
  914. # elif defined HAVE_MEMCHECK_H
  915. # include <memcheck.h>
  916. # else
  917. # include <valgrind.h>
  918. # endif
  919. /* Compatibility macros to let valgrind 3.1 work. */
  920. # ifndef VALGRIND_MAKE_MEM_NOACCESS
  921. # define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
  922. # endif
  923. # ifndef VALGRIND_MAKE_MEM_DEFINED
  924. # define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
  925. # endif
  926. # ifndef VALGRIND_MAKE_MEM_UNDEFINED
  927. # define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
  928. # endif
  929. #else
  930. /* Avoid #ifdef:s when we can help it. */
  931. #define VALGRIND_DISCARD(x)
  932. #define VALGRIND_MALLOCLIKE_BLOCK(w,x,y,z)
  933. #define VALGRIND_FREELIKE_BLOCK(x,y)
  934. #endif
  935. /* In LTO -fwhole-program build we still want to keep the debug functions available
  936. for debugger. Mark them as used to prevent removal. */
  937. #if (GCC_VERSION > 4000)
  938. #define DEBUG_FUNCTION __attribute__ ((__used__))
  939. #define DEBUG_VARIABLE __attribute__ ((__used__))
  940. #else
  941. #define DEBUG_FUNCTION
  942. #define DEBUG_VARIABLE
  943. #endif
  944. /* General macro to extract bit Y of X. */
  945. #define TEST_BIT(X, Y) (((X) >> (Y)) & 1)
  946. /* Get definitions of HOST_WIDE_INT. */
  947. #include "hwint.h"
  948. #endif /* ! GCC_SYSTEM_H */