]>
gcc.gnu.org Git - gcc.git/blob - fixincludes/system.h
1 /* Get common system includes and various definitions and declarations based
3 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
4 Free Software Foundation, Inc.
6 This file is part of libcpp (aka cpplib).
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING. If not, write to the Free
20 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
24 #ifndef FIXINC_SYSTEM_H
25 #define FIXINC_SYSTEM_H
27 /* We must include stdarg.h before stdio.h. */
36 /* Define a generic NULL if one hasn't already been defined. */
41 /* fixincludes is not a multi-threaded application and therefore we
42 do not have to use the locking functions. In fact, using the locking
43 functions can cause the compiler to be significantly slower under
44 I/O bound conditions (such as -g -O0 on very large source files).
46 HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
47 code is multi-thread safe by default. If it is set to 0, then do
48 not worry about using the _unlocked functions.
50 fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
51 extensions and need to be prototyped by hand (since we do not
52 define _GNU_SOURCE). */
54 #if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
56 # ifdef HAVE_PUTC_UNLOCKED
58 # define putc(C, Stream) putc_unlocked (C, Stream)
60 # ifdef HAVE_PUTCHAR_UNLOCKED
62 # define putchar(C) putchar_unlocked (C)
64 # ifdef HAVE_GETC_UNLOCKED
66 # define getc(Stream) getc_unlocked (Stream)
68 # ifdef HAVE_GETCHAR_UNLOCKED
70 # define getchar() getchar_unlocked ()
72 # ifdef HAVE_FPUTC_UNLOCKED
74 # define fputc(C, Stream) fputc_unlocked (C, Stream)
77 # ifdef HAVE_CLEARERR_UNLOCKED
79 # define clearerr(Stream) clearerr_unlocked (Stream)
80 # if defined (HAVE_DECL_CLEARERR_UNLOCKED) && !HAVE_DECL_CLEARERR_UNLOCKED
81 extern void clearerr_unlocked (FILE *);
84 # ifdef HAVE_FEOF_UNLOCKED
86 # define feof(Stream) feof_unlocked (Stream)
87 # if defined (HAVE_DECL_FEOF_UNLOCKED) && !HAVE_DECL_FEOF_UNLOCKED
88 extern int feof_unlocked (FILE *);
91 # ifdef HAVE_FILENO_UNLOCKED
93 # define fileno(Stream) fileno_unlocked (Stream)
94 # if defined (HAVE_DECL_FILENO_UNLOCKED) && !HAVE_DECL_FILENO_UNLOCKED
95 extern int fileno_unlocked (FILE *);
98 # ifdef HAVE_FFLUSH_UNLOCKED
100 # define fflush(Stream) fflush_unlocked (Stream)
101 # if defined (HAVE_DECL_FFLUSH_UNLOCKED) && !HAVE_DECL_FFLUSH_UNLOCKED
102 extern int fflush_unlocked (FILE *);
105 # ifdef HAVE_FGETC_UNLOCKED
107 # define fgetc(Stream) fgetc_unlocked (Stream)
108 # if defined (HAVE_DECL_FGETC_UNLOCKED) && !HAVE_DECL_FGETC_UNLOCKED
109 extern int fgetc_unlocked (FILE *);
112 # ifdef HAVE_FGETS_UNLOCKED
114 # define fgets(S, n, Stream) fgets_unlocked (S, n, Stream)
115 # if defined (HAVE_DECL_FGETS_UNLOCKED) && !HAVE_DECL_FGETS_UNLOCKED
116 extern char *fgets_unlocked (char *, int, FILE *);
119 # ifdef HAVE_FPUTS_UNLOCKED
121 # define fputs(String, Stream) fputs_unlocked (String, Stream)
122 # if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
123 extern int fputs_unlocked (const char *, FILE *);
126 # ifdef HAVE_FERROR_UNLOCKED
128 # define ferror(Stream) ferror_unlocked (Stream)
129 # if defined (HAVE_DECL_FERROR_UNLOCKED) && !HAVE_DECL_FERROR_UNLOCKED
130 extern int ferror_unlocked (FILE *);
133 # ifdef HAVE_FREAD_UNLOCKED
135 # define fread(Ptr, Size, N, Stream) fread_unlocked (Ptr, Size, N, Stream)
136 # if defined (HAVE_DECL_FREAD_UNLOCKED) && !HAVE_DECL_FREAD_UNLOCKED
137 extern size_t fread_unlocked (void *, size_t, size_t, FILE *);
140 # ifdef HAVE_FWRITE_UNLOCKED
142 # define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
143 # if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
144 extern size_t fwrite_unlocked (const void *, size_t, size_t, FILE *);
147 # ifdef HAVE_FPRINTF_UNLOCKED
149 /* We can't use a function-like macro here because we don't know if
150 we have varargs macros. */
151 # define fprintf fprintf_unlocked
152 # if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
153 extern int fprintf_unlocked (FILE *, const char *, ...);
159 /* ??? Glibc's fwrite/fread_unlocked macros cause
160 "warning: signed and unsigned type in conditional expression". */
161 #undef fread_unlocked
162 #undef fwrite_unlocked
164 #include <sys/types.h>
167 #if !defined (errno) && defined (HAVE_DECL_ERRNO) && !HAVE_DECL_ERRNO
171 /* Some of glibc's string inlines cause warnings. Plus we'd rather
172 rely on (and therefore test) GCC's string builtins. */
173 #define __NO_STRING_INLINES
178 # ifdef HAVE_STRINGS_H
179 # include <strings.h>
194 # ifdef HAVE_SYS_FILE_H
195 # include <sys/file.h>
199 /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1. If they
200 are defined to 0 then we must provide the relevant declaration
201 here. These checks will be in the undefined state while configure
202 is running so be careful to test "defined (HAVE_DECL_*)". */
204 #if defined (HAVE_DECL_ABORT) && !HAVE_DECL_ABORT
205 extern void abort (void);
209 # include <sys/stat.h>
212 /* Test if something is a normal file. */
214 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
217 /* Filename handling macros. */
218 #include "filenames.h"
220 /* Get libiberty declarations. */
221 #include "libiberty.h"
222 #include "safe-ctype.h"
224 #endif /* ! FIXINC_SYSTEM_H */
This page took 0.048831 seconds and 6 git commands to generate.