summaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2001-09-28 07:00:27 +0000
committerZack Weinberg <zack@gcc.gnu.org>2001-09-28 07:00:27 +0000
commit3b681e9dccc5cbbddecbcc1a0c41c51f7fbef57d (patch)
tree206ad049b411ef90070a3486a0832ecc5adf0c79 /gcc/system.h
parentc0636171dba6e1d76e6ab328182797d370f0ec91 (diff)
downloadgcc-3b681e9dccc5cbbddecbcc1a0c41c51f7fbef57d.tar.gz
cpplex.c (cpp_output_token): Use a putc loop for SPELL_OPERATOR, and fwrite for SPELL_IDENT.
* cpplex.c (cpp_output_token): Use a putc loop for SPELL_OPERATOR, and fwrite for SPELL_IDENT. * configure.in: Detect fwrite_unlocked and fprintf_unlocked. * configure, config.in: Regenerate. * system.h: Replace fwrite and fprintf with their unlocked variants if available. From-SVN: r45855
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h55
1 files changed, 40 insertions, 15 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 7938fb6bdf2..38767c7402b 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -55,28 +55,53 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#endif
/* The compiler is not a multi-threaded application and therefore we
- do not have to use the locking functions.
+ do not have to use the locking functions. In fact, using the locking
+ functions can cause the compiler to be significantly slower under
+ I/O bound conditions (such as -g -O0 on very large source files).
- HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the IO
+ HAVE_DECL_PUTC_UNLOCKED actually indicates whether or not the stdio
code is multi-thread safe by default. If it is set to 0, then do
not worry about using the _unlocked functions.
- fputs_unlocked is an extension and needs to be prototyped specially. */
+ fputs_unlocked, fwrite_unlocked, and fprintf_unlocked are
+ extensions and need to be prototyped by hand (since we do not
+ define _GNU_SOURCE). */
-#if defined HAVE_PUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
-# undef putc
-# define putc(C, Stream) putc_unlocked (C, Stream)
-#endif
-#if defined HAVE_FPUTC_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
-# undef fputc
-# define fputc(C, Stream) fputc_unlocked (C, Stream)
-#endif
-#if defined HAVE_FPUTS_UNLOCKED && (defined (HAVE_DECL_PUTC_UNLOCKED) && HAVE_DECL_PUTC_UNLOCKED)
-# undef fputs
-# define fputs(String, Stream) fputs_unlocked (String, Stream)
-# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
+#if defined HAVE_DECL_PUTC_UNLOCKED && HAVE_DECL_PUTC_UNLOCKED
+
+# ifdef HAVE_PUTC_UNLOCKED
+# undef putc
+# define putc(C, Stream) putc_unlocked (C, Stream)
+# endif
+# ifdef HAVE_FPUTC_UNLOCKED
+# undef fputc
+# define fputc(C, Stream) fputc_unlocked (C, Stream)
+# endif
+
+# ifdef HAVE_FPUTS_UNLOCKED
+# undef fputs
+# define fputs(String, Stream) fputs_unlocked (String, Stream)
+# if defined (HAVE_DECL_FPUTS_UNLOCKED) && !HAVE_DECL_FPUTS_UNLOCKED
extern int fputs_unlocked PARAMS ((const char *, FILE *));
+# endif
+# endif
+# ifdef HAVE_FWRITE_UNLOCKED
+# undef fwrite
+# define fwrite(Ptr, Size, N, Stream) fwrite_unlocked (Ptr, Size, N, Stream)
+# if defined (HAVE_DECL_FWRITE_UNLOCKED) && !HAVE_DECL_FWRITE_UNLOCKED
+extern int fwrite_unlocked PARAMS ((const PTR, size_t, size_t, FILE *));
+# endif
# endif
+# ifdef HAVE_FPRINTF_UNLOCKED
+# undef fprintf
+/* We can't use a function-like macro here because we don't know if
+ we have varargs macros. */
+# define fprintf fprintf_unlocked
+# if defined (HAVE_DECL_FPRINTF_UNLOCKED) && !HAVE_DECL_FPRINTF_UNLOCKED
+extern int fprintf_unlocked PARAMS ((FILE *, const char *, ...));
+# endif
+# endif
+
#endif
/* There are an extraordinary number of issues with <ctype.h>.