]> granicus.if.org Git - clang/commitdiff
wrap some long diagnostics, make 'initializer is not a constant' diagnostic
authorChris Lattner <sabre@nondot.org>
Sun, 10 Aug 2008 01:58:45 +0000 (01:58 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 10 Aug 2008 01:58:45 +0000 (01:58 +0000)
a bit more clear (rdar://5646070)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54606 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 076ccce0d024169f89a048d8ed8bcf067c8f4a20..886b2970d1861456c92bc42b7666646ee3244efd 100644 (file)
@@ -719,7 +719,8 @@ DIAG(err_param_default_argument_references_param, ERROR,
 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_at_least_one_initializer_needed_to_size_array, ERROR,
 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_incompatible_vector, ERROR,
 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")
index c1a789ea5b35b89ee71557cca0edcf4bc02088ec..7aecdda40e840a59c4e927bdac0ebf0406e0d8d1 100644 (file)
@@ -4,8 +4,8 @@ extern int foof() = 1; // expected-error{{illegal initializer (only variables ca
 
 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}}
 
index f25d54fc90fd1201c216e385b670407cc5caac94..5f31ae6648cf4782c0d023286692d42899de4a41 100644 (file)
@@ -4,11 +4,11 @@ struct foo { int a, b; };
 
 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}}
index b7702dd24acee96d7c75f9c7986e9cd35c3e974d..1fbff69cb5879445f78760ce4957c9a7285b2003 100644 (file)
@@ -34,7 +34,7 @@ public:
   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;
 
index efc934d57a54b47ae5d3a1ef865fd78d56a8aa4e..b57f046a040699d250f6d68805846381bc73e293 100644 (file)
@@ -38,7 +38,7 @@ int *t = &(*s).z;
 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;
 }
index 2439d5e714e5372168f70f2e4460977c80a939fc..2f1380062d3206782bf89ecdb124acacbc1e909a 100644 (file)
@@ -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;
index e8956fd78a1170fa7b0191c451878dbcef50f343..5f4857e3101686b9ee0a496dd3d8da2ccd16b4df 100644 (file)
@@ -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