# HG changeset patch # User John W. Eaton # Date 1345823150 14400 # Node ID a0af93de0ba3f2d0ccb7beb60cd76768d68aba92 # Parent 2d337a9869e9fab0c048cfbd292f94193e25e7c9 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. diff --git a/liboctave/lo-cutils.c b/liboctave/lo-cutils.c --- a/liboctave/lo-cutils.c +++ b/liboctave/lo-cutils.c @@ -24,6 +24,8 @@ #include #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;