gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / tests / test-sys_wait.c
index 917de0d..7753da3 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <sys/wait.h> substitute.
-   Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2009-2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 /* Check for existence of required types.  */
 static pid_t a;
 
+#include "test-sys_wait.h"
+
 int
 main (void)
 {
-  /* Check for existence of required macros.  Note that we document
-     that these are safe only on lvalues.  */
-  int i;
-  for (i = 0; i < 0x10000; i = (i ? i << 1 : 1))
-    if (!!WIFSIGNALED (i) + !!WIFEXITED (i) + !!WIFSTOPPED (i) != 1)
-      return 1;
-  i = WEXITSTATUS (i) + WSTOPSIG (i) + WTERMSIG (i);
-
-  switch (i)
-    {
+  if (test_sys_wait_macros ())
+    return 1;
+
 #if 0
+  switch (WCONTINUED)
+    {
   /* Gnulib doesn't guarantee these, yet.  */
     case WCONTINUED:
-    case WNOHANG:
-    case WUNTRACED:
     case WEXITED:
     case WNOWAIT:
     case WSTOPPED:
-#endif
       break;
     }
-  return a ? i : 0;
+#endif
+
+  return a ? 1 : 0;
 }