changeset 15227:a0af93de0ba3

fix compilation problem if wait macros are undefined * lo-cutils.c: Include lo-error.h. (gripe_missing_wait_macro): New function. (octave_wifexited, octave_wexitstatus, octave_wifsignaled, octave_wtermsig, octave_wcoredump, octave_wifstopped, octave_wstopsig, octave_wifcontinued): Use gripe_missing_wait_macro for warning.
author John W. Eaton <jwe@octave.org>
date Fri, 24 Aug 2012 11:45:50 -0400
parents 2d337a9869e9
children fbecbce45898
files liboctave/lo-cutils.c
diffstat 1 files changed, 34 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/lo-cutils.c
+++ b/liboctave/lo-cutils.c
@@ -24,6 +24,8 @@
 #include <config.h>
 #endif
 
+#include "lo-error.h"
+
 /* This gives us a better chance of finding a prototype for strptime
    on some systems.  */
 
@@ -77,113 +79,121 @@
   return WAITPID (pid, status, options);
 }
 
-OCTAVE_API int octave_wifexited (int status)
+static void
+gripe_missing_wait_macro (const char *id, int status)
+{
+  (*current_liboctave_warning_handler)
+    ("%s always returns false in this version of Octave; status = %d",
+     id, status);
+}
+
+OCTAVE_API int
+octave_wifexited (int status)
 {
   int retval = 0;
 
 #if defined (WIFEXITED)
   retval = WIFEXITED (status);
 #else
-  (*liboctave_warning_handler)
-    ("WIFEXITED always returns false in this version of Octave");
+  gripe_missing_wait_macro ("WIFEXITED", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wexitstatus (int status)
+OCTAVE_API int
+octave_wexitstatus (int status)
 {
   int retval = 0;
 
 #if defined (WEXITSTATUS)
   retval = WEXITSTATUS (status);
 #else
-  (*liboctave_warning_handler)
-    ("WEXITSTATUS always returns 0 in this version of Octave");
+  gripe_missing_wait_macro ("WEXITSTATUS", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wifsignaled (int status)
+OCTAVE_API int
+octave_wifsignaled (int status)
 {
   int retval = 0;
 
 #if defined (WIFSIGNALED)
   retval = WIFSIGNALED (status);
 #else
-  (*liboctave_warning_handler)
-    ("WIFSIGNALED always returns false in this version of Octave");
+  gripe_missing_wait_macro ("WIFSIGNALED", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wtermsig (int status)
+OCTAVE_API int
+octave_wtermsig (int status)
 {
   int retval = 0;
 
 #if defined (WTERMSIG)
   retval = WTERMSIG (status);
 #else
-  (*liboctave_warning_handler)
-    ("WTERMSIG always returns 0 in this version of Octave");
+  gripe_missing_wait_macro ("WTERMSIG", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wcoredump (int status)
+OCTAVE_API int
+octave_wcoredump (int status)
 {
   int retval = 0;
 
 #if defined (WCOREDUMP)
   retval = WCOREDUMP (status);
 #else
-  (*liboctave_warning_handler)
-    ("WCOREDUMP always returns false in this version of Octave");
+  gripe_missing_wait_macro ("WCOREDUMP", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wifstopped (int status)
+OCTAVE_API int
+octave_wifstopped (int status)
 {
   int retval = 0;
 
 #if defined (WIFSTOPPED)
   retval = WIFSTOPPED (status);
 #else
-  (*liboctave_warning_handler)
-    ("WIFSTOPPED always returns false in this version of Octave");
+  gripe_missing_wait_macro ("WIFSTOPPED", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wstopsig (int status)
+OCTAVE_API int
+octave_wstopsig (int status)
 {
   int retval = 0;
 
 #if defined (WSTOPSIG)
   retval = WSTOPSIG (status);
 #else
-  (*liboctave_warning_handler)
-    ("WSTOPSIG always returns 0 in this version of Octave");
+  gripe_missing_wait_macro ("WSTOPSIG", status);
 #endif
 
   return retval;
 }
 
-OCTAVE_API int octave_wifcontinued (int status)
+OCTAVE_API int
+octave_wifcontinued (int status)
 {
   int retval = 0;
 
 #if defined (WIFCONTINUED)
   retval = WIFCONTINUED (status);
 #else
-  (*liboctave_warning_handler)
-    ("WIFCONTINUED always returns false in this version of Octave");
+  gripe_missing_wait_macro ("WIFCONTINUED", status);
 #endif
 
   return retval;