Minor DJGPP fixes

Laurynas Biveinis lauras@softhome.net
Sun Apr 30 12:13:00 GMT 2000


This fixes two problems encountered when building current CVS sources:

1) compiling i386.c fails with INT_ASM_OP undefined;
2) C preprocessor (read_include_file() in cppfiles.c) fails to do 
   anything under DJGPP because DJGPP does not support 
   fcntl(..., F_SETFL, ...).
   I made a fix similar to code present in libgcc2.c, __bb_exit_func(),
   with new target macro.

This is my first patch to GCC, so I'd like hear feedback what I've
done wrong. I believe changes are pretty small so they can be accepted
without copyright assignment, but I'll send it in future.

I'm not subscribed to gcc-patches yet; please CC me on replies.

2000-04-30 Laurynas Biveinis <lauras@softhome.net>

	* config/i386/djgpp.h (INT_ASM_OP): define.
	* cppfiles.c (read_include_file): call fcntl(fd, F_SETFL, 0) only if
	macro TARGET_HAS_F_SETFL defined.
	* tm.texi: describe TARGET_HAS_F_SETFL. Fix typo in TARGET_HAS_F_SETFLKW
	description.

diff -u -r cvs/gcc/gcc/config/i386/djgpp.h gcc/gcc/config/i386/djgpp.h
--- cvs/gcc/gcc/config/i386/djgpp.h	Thu Mar 30 04:19:20 2000
+++ gcc/gcc/config/i386/djgpp.h	Sun Apr 30 19:34:28 2000
@@ -205,3 +205,8 @@
 
 /* Used to be defined in xm-djgpp.h, but moved here for cross-compilers.  */
 #define LIBSTDCXX "-lstdcxx"
+
+/* This is the pseudo-op used to generate a 32-bit word of data with a
+   specific value in some section.  */
+
+#define INT_ASM_OP ".long"
diff -u -r cvs/gcc/gcc/cppfiles.c gcc/gcc/cppfiles.c
--- cvs/gcc/gcc/cppfiles.c	Sun Apr 30 20:12:08 2000
+++ gcc/gcc/cppfiles.c	Sun Apr 30 20:01:38 2000
@@ -708,9 +707,14 @@
 
   if (fstat (fd, &st) < 0)
     goto perror_fail;
+
+#ifdef TARGET_HAS_F_SETFL
+
   if (fcntl (fd, F_SETFL, 0) == -1)  /* turn off nonblocking mode */
     goto perror_fail;
 
+#endif /* TARGET_HAS_F_SETFL */
+
   /* If fd points to a plain file, we know how big it is, so we can
      allocate the buffer all at once.  If fd is a pipe or terminal, we
      can't.  Most C source files are 4k or less, so we guess that.  If
diff -u -r cvs/gcc/gcc/tm.texi gcc/gcc/tm.texi
--- cvs/gcc/gcc/tm.texi	Wed Apr 26 00:10:26 2000
+++ gcc/gcc/tm.texi	Sun Apr 30 20:00:30 2000
@@ -7949,12 +7949,16 @@
 
 @findex TARGET_HAS_F_SETLKW
 @item TARGET_HAS_F_SETLKW
-Define this macro iff the target supports file locking with fcntl / F_SETLKW.
+Define this macro if the target supports file locking with fcntl / F_SETLKW.
 Note that this functionality is part of POSIX.
 Defining @code{TARGET_HAS_F_SETLKW} will enable the test coverage code
 to use file locking when exiting a program, which avoids race conditions
 if the program has forked.
 
+@findex TARGET_HAS_F_SETFL
+@item TARGET_HAS_F_SETFL
+Define this macro if the target supports setting file mode with fcntl / F_SETFL.
+
 @findex MAX_CONDITIONAL_EXECUTE
 @item MAX_CONDITIONAL_EXECUTE



More information about the Gcc-patches mailing list