autoupdate
[pspp] / tests / test-stdbool.c
index bb8d6f36f6aead9fa1c2b59bc4e5bbbfb88413ee..12b4fe8335ca74fbe80d2a889f580485c9f13693 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of <stdbool.h> substitute.
-   Copyright (C) 2002-2007, 2009-2010 Free Software Foundation, Inc.
+   Copyright (C) 2002-2007, 2009-2011 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
@@ -90,10 +90,16 @@ _Bool *pq = &q;
 int
 main ()
 {
+  int error = 0;
+
 #if HAVE_STDBOOL_H || defined __GNUC__ /* See above.  */
 # ifdef ADDRESS_CHECK_OKAY /* Avoid gcc warning.  */
   /* A cast from a variable's address to bool is valid in expressions.  */
-  bool e1 = &s;
+  {
+    bool e1 = &s;
+    if (!e1)
+      error = 1;
+  }
 # endif
 #endif
 
@@ -102,6 +108,11 @@ main ()
      http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
      This is a runtime test, since a corresponding compile-time
      test would rely on initializer extensions.  */
-  char digs[] = "0123456789";
-  return &(digs + 5)[-2 + (bool) 1] != &digs[4];
+  {
+    char digs[] = "0123456789";
+    if (&(digs + 5)[-2 + (bool) 1] != &digs[4])
+      error = 1;
+  }
+
+  return error;
 }