Avoid using the fallback implementation; prefer porting efforts.
authorBruno Haible <bruno@clisp.org>
Sat, 10 Mar 2007 16:08:20 +0000 (16:08 +0000)
committerBruno Haible <bruno@clisp.org>
Sat, 10 Mar 2007 16:08:20 +0000 (16:08 +0000)
ChangeLog
lib/fseterr.c

index 9eef4ac..5f26043 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-03-10  Bruno Haible  <bruno@clisp.org>
 
+       * lib/fseterr.c (fseterr): Port to Solaris/SPARC64. Deactivate the
+       fallback; use #error instead.
+       Suggested by Simon Josefsson.
+
+2007-03-10  Bruno Haible  <bruno@clisp.org>
+
        * gnulib-tool (func_create_testdir): Treat MOSTLYCLEANFILES like
        CLEANFILES. Put spaces in each line of $cleaned_files, not only the
        first and the last.
index 3f87615..52b4727 100644 (file)
@@ -33,10 +33,17 @@ fseterr (FILE *fp)
 #elif defined __sferror             /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */
   fp->_flags |= __SERR;
 #elif defined _IOERR                /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
+# if defined __sun && defined __sparc && defined _LP64 /* Solaris/SPARC 64-bit */
+  ((unsigned int *) fp) [9] |= 0x20;
+# else
   fp->_flag |= _IOERR;
-#else                               /* unknown  */
+# endif
+#elif 0                             /* unknown  */
   /* Portable fallback, based on an idea by Rich Felker.
-     Wow! 6 system calls for something that is just a bit operation!  */
+     Wow! 6 system calls for something that is just a bit operation!
+     Not activated on any system, because there is no way to repair FP when
+     the sequence of system calls fails, and library code should not call
+     abort().  */
   int saved_errno;
   int fd;
   int fd2;
@@ -56,5 +63,7 @@ fseterr (FILE *fp)
       close (fd2);
     }
   errno = saved_errno;
+#else
+ #error "Please port gnulib fseterr.c to your platform! Look at the definitions of ferror and clearerr on your system, then report this to bug-gnulib."
 #endif
 }