r179429 - Headers: Don't try to use RSIZE_MAX unless we are freestanding.

Daniel Dunbar daniel at zuster.org
Fri Apr 12 16:41:09 PDT 2013


Author: ddunbar
Date: Fri Apr 12 18:41:08 2013
New Revision: 179429

URL: http://llvm.org/viewvc/llvm-project?rev=179429&view=rev
Log:
Headers: Don't try to use RSIZE_MAX unless we are freestanding.
 - We don't want to depend on the platforms stdint.h.

Modified:
    cfe/trunk/test/Headers/c11.c

Modified: cfe/trunk/test/Headers/c11.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/c11.c?rev=179429&r1=179428&r2=179429&view=diff
==============================================================================
--- cfe/trunk/test/Headers/c11.c (original)
+++ cfe/trunk/test/Headers/c11.c Fri Apr 12 18:41:08 2013
@@ -1,5 +1,6 @@
 // RUN: %clang -fsyntax-only -Xclang -verify -std=c11 %s
 // RUN: %clang -fsyntax-only -Xclang -verify -std=c11 -fmodules %s
+// RUN: %clang -fsyntax-only -Xclang -verify -std=c11 -ffreestanding %s
 
 noreturn int f(); // expected-error 1+{{}}
 
@@ -21,4 +22,11 @@ _Static_assert(__alignof(c) == 4, "");
 #define __STDC_WANT_LIB_EXT1__ 1
 #include <stddef.h>
 #include <stdint.h>
-rsize_t x = RSIZE_MAX;
+rsize_t x = 0;
+
+// If we are freestanding, then also check RSIZE_MAX (in a hosted implementation
+// we will use the host stdint.h, which may not yet have C11 support).
+#ifndef __STDC_HOSTED__
+rsize_t x2 = RSIZE_MAX;
+#endif
+





More information about the cfe-commits mailing list