[cfe-commits] r54606 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def test/Sema/array-init.c test/Sema/compound-literal.c test/Sema/cxx-class.cpp test/Sema/init.c test/Sema/static-init.c test/Sema/vla.c

Chris Lattner sabre at nondot.org
Sat Aug 9 18:58:46 PDT 2008


Author: lattner
Date: Sat Aug  9 20:58:45 2008
New Revision: 54606

URL: http://llvm.org/viewvc/llvm-project?rev=54606&view=rev
Log:
wrap some long diagnostics, make 'initializer is not a constant' diagnostic
a bit more clear (rdar://5646070)

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticKinds.def
    cfe/trunk/test/Sema/array-init.c
    cfe/trunk/test/Sema/compound-literal.c
    cfe/trunk/test/Sema/cxx-class.cpp
    cfe/trunk/test/Sema/init.c
    cfe/trunk/test/Sema/static-init.c
    cfe/trunk/test/Sema/vla.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticKinds.def Sat Aug  9 20:58:45 2008
@@ -719,7 +719,8 @@
 DIAG(err_param_default_argument_references_local, ERROR,
      "default argument references local variable '%0' of enclosing function")
 DIAG(err_param_default_argument_nonfunc, ERROR,
-     "default arguments can only be specified for parameters in a function declaration")
+     "default arguments can only be specified for parameters in a function"
+     " declaration")
 DIAG(err_previous_definition, ERROR,
      "previous definition is here")
 DIAG(err_previous_use, ERROR,
@@ -786,7 +787,7 @@
 DIAG(err_array_size_non_int, ERROR,
      "size of array has non-integer type '%0'")
 DIAG(err_init_element_not_constant, ERROR,
-     "initializer element is not constant")
+     "initializer element is not a compile-time constant")
 DIAG(err_block_extern_cant_init, ERROR,
      "'extern' variable cannot have an initializer")
 DIAG(warn_extern_init, WARNING,
@@ -1140,7 +1141,8 @@
 DIAG(err_shufflevector_nonconstant_argument, ERROR,
      "indexes for __builtin_shufflevector must be constant integers")
 DIAG(err_shufflevector_argument_too_large, ERROR,
-     "indexes for __builtin_shufflevector must be less than the total number of vector elements")
+     "indexes for __builtin_shufflevector must be less than the total number"
+     " of vector elements")
 
 DIAG(err_stack_const_level, ERROR,
      "the level argument for a stack address builtin must be constant")

Modified: cfe/trunk/test/Sema/array-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/array-init.c?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/array-init.c (original)
+++ cfe/trunk/test/Sema/array-init.c Sat Aug  9 20:58:45 2008
@@ -4,8 +4,8 @@
 
 static int x, y, z;
 
-static int ary[] = { x, y, z }; // expected-error{{initializer element is not constant}}
-int ary2[] = { x, y, z }; // expected-error{{initializer element is not constant}}
+static int ary[] = { x, y, z }; // expected-error{{initializer element is not a compile-time constant}}
+int ary2[] = { x, y, z }; // expected-error{{initializer element is not a compile-time constant}}
 
 extern int fileScopeExtern[3] = { 1, 3, 5 }; // expected-warning{{'extern' variable has an initializer}}
 

Modified: cfe/trunk/test/Sema/compound-literal.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/compound-literal.c?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/compound-literal.c (original)
+++ cfe/trunk/test/Sema/compound-literal.c Sat Aug  9 20:58:45 2008
@@ -4,11 +4,11 @@
 
 static struct foo t = (struct foo){0,0};
 static struct foo t2 = {0,0}; 
-static struct foo t3 = t2; // -expected-error {{initializer element is not constant}}
+static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
 static int *p = (int []){2,4}; 
 static int x = (int){1}; // -expected-warning{{braces around scalar initializer}}
 
-static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not constant}}
+static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
 static int *p3 = (int []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'char [2]', expected 'int'}}
 
 typedef struct { } cache_t; // -expected-warning{{use of empty struct extension}}

Modified: cfe/trunk/test/Sema/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/cxx-class.cpp?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/cxx-class.cpp (original)
+++ cfe/trunk/test/Sema/cxx-class.cpp Sat Aug  9 20:58:45 2008
@@ -34,7 +34,7 @@
   int i = 0; // expected-error {{error: 'i' can only be initialized if it is a static const integral data member}}
   static int si = 0; // expected-error {{error: 'si' can only be initialized if it is a static const integral data member}}
   static const NestedC ci = 0; // expected-error {{error: 'ci' can only be initialized if it is a static const integral data member}}
-  static const int nci = vs; // expected-error {{error: initializer element is not constant}}
+  static const int nci = vs; // expected-error {{error: initializer element is not a compile-time constant}}
   static const int vi = 0;
   static const E evi = 0;
 

Modified: cfe/trunk/test/Sema/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/init.c?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/init.c (original)
+++ cfe/trunk/test/Sema/init.c Sat Aug  9 20:58:45 2008
@@ -38,7 +38,7 @@
 short *a2(void)
 {
   short int b;
-  static short *bp = &b; // expected-error {{initializer element is not constant}}
+  static short *bp = &b; // expected-error {{initializer element is not a compile-time constant}}
 
   return bp;
 }

Modified: cfe/trunk/test/Sema/static-init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/static-init.c?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/static-init.c (original)
+++ cfe/trunk/test/Sema/static-init.c Sat Aug  9 20:58:45 2008
@@ -1,7 +1,7 @@
 // RUN: clang -fsyntax-only -verify %s
 static int f = 10;
-static int b = f; // expected-error {{initializer element is not constant}}
+static int b = f; // expected-error {{initializer element is not a compile-time constant}}
 
-float r  = (float) &r; // expected-error {{initializer element is not constant}}
+float r  = (float) &r; // expected-error {{initializer element is not a compile-time constant}}
 long long s = (long long) &s;
 _Bool t = &t;

Modified: cfe/trunk/test/Sema/vla.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/vla.c?rev=54606&r1=54605&r2=54606&view=diff

==============================================================================
--- cfe/trunk/test/Sema/vla.c (original)
+++ cfe/trunk/test/Sema/vla.c Sat Aug  9 20:58:45 2008
@@ -2,7 +2,7 @@
 
 int test1() {
   typedef int x[test1()];  // vla
-  static int y = sizeof(x);  // expected-error {{not constant}}
+  static int y = sizeof(x);  // expected-error {{not a compile-time constant}}
 }
 
 // PR2347





More information about the cfe-commits mailing list