aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-20 08:01:23 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-12-20 08:01:59 +0100
commit9933b78872f59fd092be0b473d9ca7e7f757e1c3 (patch)
tree3eebfa36dc58fe5982d479f75770900b5ef1ca22
parent41c40878c422428749f29a5fa2c7b198a8ef9921 (diff)
parentd290b052e19e56733236a48050950caa86b82a98 (diff)
downloadsparse-9933b78872f59fd092be0b473d9ca7e7f757e1c3.tar.gz
Merge branch 'show-type'
* small improvemnets to show_typename()'s outout: * strip trailing space * don't display '<noident>' * do not display base type's redundant specifiers * do not let display string_ctype lika a base type 'string'
-rw-r--r--show-parse.c10
-rw-r--r--validation/bad-type-twice1.c2
-rw-r--r--validation/bitwise-cast-ptr.c2
-rw-r--r--validation/builtin-overflow.c72
-rw-r--r--validation/c11-atomic.c6
-rw-r--r--validation/cast-bad-00.c4
-rw-r--r--validation/choose_expr.c8
-rw-r--r--validation/enum-mismatch.c4
-rw-r--r--validation/expand/builtin-expect.c4
-rw-r--r--validation/nocast.c2
-rw-r--r--validation/noderef.c2
-rw-r--r--validation/ptr-inherit.c10
-rw-r--r--validation/restrict.c6
13 files changed, 69 insertions, 63 deletions
diff --git a/show-parse.c b/show-parse.c
index 5325f019..3aa06e47 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -249,7 +249,6 @@ static struct ctype_name {
{ &void_ctype, "void", "" },
{ &bool_ctype, "bool", "" },
- { &string_ctype, "string", "" },
{ &float_ctype, "float", "F" },
{ &double_ctype, "double", "" },
@@ -309,6 +308,8 @@ deeper:
if (as)
prepend(name, "%s ", show_as(as));
+ if (sym->type == SYM_BASETYPE || sym->type == SYM_ENUM)
+ mod &= ~MOD_SPECIFIER;
s = modifier_string(mod);
len = strlen(s);
name->start -= len;
@@ -364,7 +365,8 @@ deeper:
break;
case SYM_NODE:
- append(name, "%s", show_ident(sym->ident));
+ if (sym->ident)
+ append(name, "%s", show_ident(sym->ident));
mod |= sym->ctype.modifiers;
combine_address_space(sym->pos, &as, sym->ctype.as);
break;
@@ -419,6 +421,10 @@ out:
prepend(name, "restricted ");
if (fouled)
prepend(name, "fouled ");
+
+ // strip trailing space
+ if (name->end > name->start && name->end[-1] == ' ')
+ name->end--;
}
void show_type(struct symbol *sym)
diff --git a/validation/bad-type-twice1.c b/validation/bad-type-twice1.c
index 95cfd9e0..cc81662a 100644
--- a/validation/bad-type-twice1.c
+++ b/validation/bad-type-twice1.c
@@ -10,7 +10,7 @@ static unsigned long foo(unsigned long val, void *ref)
*
* check-error-start
bad-type-twice1.c:3:17: error: incompatible types for operation (>=)
-bad-type-twice1.c:3:17: left side has type unsigned long [unsigned] val
+bad-type-twice1.c:3:17: left side has type unsigned long val
bad-type-twice1.c:3:17: right side has type void *ref
* check-error-end
*/
diff --git a/validation/bitwise-cast-ptr.c b/validation/bitwise-cast-ptr.c
index 3f2bfdaf..77927f49 100644
--- a/validation/bitwise-cast-ptr.c
+++ b/validation/bitwise-cast-ptr.c
@@ -28,6 +28,6 @@ static __be32* tobf(u32 *x)
bitwise-cast-ptr.c:9:16: warning: incorrect type in return expression (different base types)
bitwise-cast-ptr.c:9:16: expected restricted __be32 [usertype] *
bitwise-cast-ptr.c:9:16: got unsigned int [usertype] *x
-bitwise-cast-ptr.c:14:17: warning: cast to restricted __be32 [usertype] *<noident>
+bitwise-cast-ptr.c:14:17: warning: cast to restricted __be32 [usertype] *
* check-error-end
*/
diff --git a/validation/builtin-overflow.c b/validation/builtin-overflow.c
index a3dacc26..c3d1d3aa 100644
--- a/validation/builtin-overflow.c
+++ b/validation/builtin-overflow.c
@@ -139,17 +139,17 @@ builtin-overflow.c:59:37: error: not enough arguments for __builtin_add_overflow
builtin-overflow.c:60:37: error: not enough arguments for __builtin_add_overflow
builtin-overflow.c:61:37: error: too many arguments for __builtin_add_overflow
builtin-overflow.c:62:38: error: invalid type for argument 1:
-builtin-overflow.c:62:38: int enum e [signed] e
+builtin-overflow.c:62:38: int enum e e
builtin-overflow.c:63:41: error: invalid type for argument 2:
-builtin-overflow.c:63:41: int enum e [signed] e
+builtin-overflow.c:63:41: int enum e e
builtin-overflow.c:64:45: error: invalid type for argument 3:
-builtin-overflow.c:64:45: int enum e *<noident>
+builtin-overflow.c:64:45: int enum e *
builtin-overflow.c:65:38: error: invalid type for argument 1:
-builtin-overflow.c:65:38: bool [unsigned] [usertype] b
+builtin-overflow.c:65:38: bool [usertype] b
builtin-overflow.c:66:41: error: invalid type for argument 2:
-builtin-overflow.c:66:41: bool [unsigned] [usertype] b
+builtin-overflow.c:66:41: bool [usertype] b
builtin-overflow.c:67:45: error: invalid type for argument 3:
-builtin-overflow.c:67:45: bool *<noident>
+builtin-overflow.c:67:45: bool *
builtin-overflow.c:68:44: error: invalid type for argument 3:
builtin-overflow.c:68:44: void *p
builtin-overflow.c:70:39: error: not enough arguments for __builtin_add_overflow_p
@@ -157,17 +157,17 @@ builtin-overflow.c:71:39: error: not enough arguments for __builtin_add_overflow
builtin-overflow.c:72:39: error: not enough arguments for __builtin_add_overflow_p
builtin-overflow.c:73:39: error: too many arguments for __builtin_add_overflow_p
builtin-overflow.c:74:40: error: invalid type for argument 1:
-builtin-overflow.c:74:40: int enum e [signed] [addressable] e
+builtin-overflow.c:74:40: int enum e [addressable] e
builtin-overflow.c:75:43: error: invalid type for argument 2:
-builtin-overflow.c:75:43: int enum e [signed] [addressable] e
+builtin-overflow.c:75:43: int enum e [addressable] e
builtin-overflow.c:76:46: error: invalid type for argument 3:
-builtin-overflow.c:76:46: int enum e [signed] [addressable] e
+builtin-overflow.c:76:46: int enum e [addressable] e
builtin-overflow.c:77:40: error: invalid type for argument 1:
-builtin-overflow.c:77:40: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:77:40: bool [addressable] [usertype] b
builtin-overflow.c:78:43: error: invalid type for argument 2:
-builtin-overflow.c:78:43: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:78:43: bool [addressable] [usertype] b
builtin-overflow.c:79:46: error: invalid type for argument 3:
-builtin-overflow.c:79:46: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:79:46: bool [addressable] [usertype] b
builtin-overflow.c:80:46: error: invalid type for argument 3:
builtin-overflow.c:80:46: void *p
builtin-overflow.c:82:37: error: not enough arguments for __builtin_sub_overflow
@@ -175,17 +175,17 @@ builtin-overflow.c:83:37: error: not enough arguments for __builtin_sub_overflow
builtin-overflow.c:84:37: error: not enough arguments for __builtin_sub_overflow
builtin-overflow.c:85:37: error: too many arguments for __builtin_sub_overflow
builtin-overflow.c:86:38: error: invalid type for argument 1:
-builtin-overflow.c:86:38: int enum e [signed] [addressable] e
+builtin-overflow.c:86:38: int enum e [addressable] e
builtin-overflow.c:87:41: error: invalid type for argument 2:
-builtin-overflow.c:87:41: int enum e [signed] [addressable] e
+builtin-overflow.c:87:41: int enum e [addressable] e
builtin-overflow.c:88:45: error: invalid type for argument 3:
-builtin-overflow.c:88:45: int enum e *<noident>
+builtin-overflow.c:88:45: int enum e *
builtin-overflow.c:89:38: error: invalid type for argument 1:
-builtin-overflow.c:89:38: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:89:38: bool [addressable] [usertype] b
builtin-overflow.c:90:41: error: invalid type for argument 2:
-builtin-overflow.c:90:41: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:90:41: bool [addressable] [usertype] b
builtin-overflow.c:91:45: error: invalid type for argument 3:
-builtin-overflow.c:91:45: bool *<noident>
+builtin-overflow.c:91:45: bool *
builtin-overflow.c:92:44: error: invalid type for argument 3:
builtin-overflow.c:92:44: void *p
builtin-overflow.c:94:39: error: not enough arguments for __builtin_sub_overflow_p
@@ -193,17 +193,17 @@ builtin-overflow.c:95:39: error: not enough arguments for __builtin_sub_overflow
builtin-overflow.c:96:39: error: not enough arguments for __builtin_sub_overflow_p
builtin-overflow.c:97:39: error: too many arguments for __builtin_sub_overflow_p
builtin-overflow.c:98:40: error: invalid type for argument 1:
-builtin-overflow.c:98:40: int enum e [signed] [addressable] e
+builtin-overflow.c:98:40: int enum e [addressable] e
builtin-overflow.c:99:43: error: invalid type for argument 2:
-builtin-overflow.c:99:43: int enum e [signed] [addressable] e
+builtin-overflow.c:99:43: int enum e [addressable] e
builtin-overflow.c:100:46: error: invalid type for argument 3:
-builtin-overflow.c:100:46: int enum e [signed] [addressable] e
+builtin-overflow.c:100:46: int enum e [addressable] e
builtin-overflow.c:101:40: error: invalid type for argument 1:
-builtin-overflow.c:101:40: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:101:40: bool [addressable] [usertype] b
builtin-overflow.c:102:43: error: invalid type for argument 2:
-builtin-overflow.c:102:43: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:102:43: bool [addressable] [usertype] b
builtin-overflow.c:103:46: error: invalid type for argument 3:
-builtin-overflow.c:103:46: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:103:46: bool [addressable] [usertype] b
builtin-overflow.c:104:46: error: invalid type for argument 3:
builtin-overflow.c:104:46: void *p
builtin-overflow.c:106:37: error: not enough arguments for __builtin_mul_overflow
@@ -211,17 +211,17 @@ builtin-overflow.c:107:37: error: not enough arguments for __builtin_mul_overflo
builtin-overflow.c:108:37: error: not enough arguments for __builtin_mul_overflow
builtin-overflow.c:109:37: error: too many arguments for __builtin_mul_overflow
builtin-overflow.c:110:38: error: invalid type for argument 1:
-builtin-overflow.c:110:38: int enum e [signed] [addressable] e
+builtin-overflow.c:110:38: int enum e [addressable] e
builtin-overflow.c:111:41: error: invalid type for argument 2:
-builtin-overflow.c:111:41: int enum e [signed] [addressable] e
+builtin-overflow.c:111:41: int enum e [addressable] e
builtin-overflow.c:112:45: error: invalid type for argument 3:
-builtin-overflow.c:112:45: int enum e *<noident>
+builtin-overflow.c:112:45: int enum e *
builtin-overflow.c:113:38: error: invalid type for argument 1:
-builtin-overflow.c:113:38: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:113:38: bool [addressable] [usertype] b
builtin-overflow.c:114:41: error: invalid type for argument 2:
-builtin-overflow.c:114:41: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:114:41: bool [addressable] [usertype] b
builtin-overflow.c:115:45: error: invalid type for argument 3:
-builtin-overflow.c:115:45: bool *<noident>
+builtin-overflow.c:115:45: bool *
builtin-overflow.c:116:44: error: invalid type for argument 3:
builtin-overflow.c:116:44: void *p
builtin-overflow.c:118:39: error: not enough arguments for __builtin_mul_overflow_p
@@ -229,17 +229,17 @@ builtin-overflow.c:119:39: error: not enough arguments for __builtin_mul_overflo
builtin-overflow.c:120:39: error: not enough arguments for __builtin_mul_overflow_p
builtin-overflow.c:121:39: error: too many arguments for __builtin_mul_overflow_p
builtin-overflow.c:122:40: error: invalid type for argument 1:
-builtin-overflow.c:122:40: int enum e [signed] [addressable] e
+builtin-overflow.c:122:40: int enum e [addressable] e
builtin-overflow.c:123:43: error: invalid type for argument 2:
-builtin-overflow.c:123:43: int enum e [signed] [addressable] e
+builtin-overflow.c:123:43: int enum e [addressable] e
builtin-overflow.c:124:46: error: invalid type for argument 3:
-builtin-overflow.c:124:46: int enum e [signed] [addressable] e
+builtin-overflow.c:124:46: int enum e [addressable] e
builtin-overflow.c:125:40: error: invalid type for argument 1:
-builtin-overflow.c:125:40: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:125:40: bool [addressable] [usertype] b
builtin-overflow.c:126:43: error: invalid type for argument 2:
-builtin-overflow.c:126:43: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:126:43: bool [addressable] [usertype] b
builtin-overflow.c:127:46: error: invalid type for argument 3:
-builtin-overflow.c:127:46: bool [unsigned] [addressable] [usertype] b
+builtin-overflow.c:127:46: bool [addressable] [usertype] b
builtin-overflow.c:128:46: error: invalid type for argument 3:
builtin-overflow.c:128:46: void *p
* check-error-end
diff --git a/validation/c11-atomic.c b/validation/c11-atomic.c
index bea3dab8..e87d06cd 100644
--- a/validation/c11-atomic.c
+++ b/validation/c11-atomic.c
@@ -73,19 +73,19 @@ c11-atomic.c:11:6: error: symbol 'f02' redeclared with different type (originall
c11-atomic.c:12:6: error: symbol 'f03' redeclared with different type (originally declared at c11-atomic.c:4) - incompatible argument 1 (different modifiers)
c11-atomic.c:33:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:33:13: expected int *extern [assigned] puo
-c11-atomic.c:33:13: got int const *<noident>
+c11-atomic.c:33:13: got int const *
c11-atomic.c:34:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:34:13: expected int *extern [assigned] puo
c11-atomic.c:34:13: got int const *extern [assigned] pqo
c11-atomic.c:48:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:48:13: expected int *extern [assigned] puo
-c11-atomic.c:48:13: got int [atomic] *<noident>
+c11-atomic.c:48:13: got int [atomic] *
c11-atomic.c:49:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:49:13: expected int *extern [assigned] puo
c11-atomic.c:49:13: got int [atomic] *extern [assigned] pqo
c11-atomic.c:63:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:63:13: expected int *extern [assigned] puo
-c11-atomic.c:63:13: got int [atomic] *<noident>
+c11-atomic.c:63:13: got int [atomic] *
c11-atomic.c:64:13: warning: incorrect type in assignment (different modifiers)
c11-atomic.c:64:13: expected int *extern [assigned] puo
c11-atomic.c:64:13: got int [atomic] *extern [assigned] pqo
diff --git a/validation/cast-bad-00.c b/validation/cast-bad-00.c
index 5f4a895f..6d15485d 100644
--- a/validation/cast-bad-00.c
+++ b/validation/cast-bad-00.c
@@ -38,10 +38,10 @@ void struct_to_int(u16 val)
*
* check-error-start
cast-bad-00.c:25:18: warning: incorrect type in argument 2 (different base types)
-cast-bad-00.c:25:18: expected unsigned int [unsigned] [usertype] <noident>
+cast-bad-00.c:25:18: expected unsigned int [usertype]
cast-bad-00.c:25:18: got union u [assigned] u
cast-bad-00.c:33:18: warning: incorrect type in argument 2 (different base types)
-cast-bad-00.c:33:18: expected unsigned int [unsigned] [usertype] <noident>
+cast-bad-00.c:33:18: expected unsigned int [usertype]
cast-bad-00.c:33:18: got struct s [assigned] s
* check-error-end
*/
diff --git a/validation/choose_expr.c b/validation/choose_expr.c
index f6fd84cf..b5d2b4e6 100644
--- a/validation/choose_expr.c
+++ b/validation/choose_expr.c
@@ -7,11 +7,11 @@ static int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42);
* check-name: choose expr builtin
* check-error-start
choose_expr.c:1:51: warning: incorrect type in initializer (different base types)
-choose_expr.c:1:51: expected int static [signed] [toplevel] x
-choose_expr.c:1:51: got void <noident>
+choose_expr.c:1:51: expected int static [toplevel] x
+choose_expr.c:1:51: got void
choose_expr.c:2:41: warning: incorrect type in initializer (different base types)
-choose_expr.c:2:41: expected int static [signed] [toplevel] y
-choose_expr.c:2:41: got char *<noident>
+choose_expr.c:2:41: expected int static [toplevel] y
+choose_expr.c:2:41: got char *
choose_expr.c:4:17: warning: division by zero
* check-error-end
*/
diff --git a/validation/enum-mismatch.c b/validation/enum-mismatch.c
index f698c016..1bdb1d6c 100644
--- a/validation/enum-mismatch.c
+++ b/validation/enum-mismatch.c
@@ -13,7 +13,7 @@ static enum eb foo(enum ea a)
*
* check-error-start
enum-mismatch.c:7:16: warning: mixing different enum types
-enum-mismatch.c:7:16: unsigned int enum ea versus
-enum-mismatch.c:7:16: unsigned int enum eb
+enum-mismatch.c:7:16: unsigned int enum ea versus
+enum-mismatch.c:7:16: unsigned int enum eb
* check-error-end
*/
diff --git a/validation/expand/builtin-expect.c b/validation/expand/builtin-expect.c
index 77f714ef..f4e0664b 100644
--- a/validation/expand/builtin-expect.c
+++ b/validation/expand/builtin-expect.c
@@ -86,10 +86,10 @@ fptr:
*
* check-error-start
expand/builtin-expect.c:33:33: warning: incorrect type in argument 1 (different base types)
-expand/builtin-expect.c:33:33: expected long [signed] <noident>
+expand/builtin-expect.c:33:33: expected long
expand/builtin-expect.c:33:33: got void *a
expand/builtin-expect.c:33:36: warning: incorrect type in argument 2 (different base types)
-expand/builtin-expect.c:33:36: expected long [signed] <noident>
+expand/builtin-expect.c:33:36: expected long
expand/builtin-expect.c:33:36: got void *a
expand/builtin-expect.c:33:32: warning: incorrect type in return expression (different base types)
expand/builtin-expect.c:33:32: expected void *
diff --git a/validation/nocast.c b/validation/nocast.c
index cc0ab6b7..6c5da968 100644
--- a/validation/nocast.c
+++ b/validation/nocast.c
@@ -160,7 +160,7 @@ nocast.c:34:33: got unsigned long
nocast.c:34:33: warning: implicit cast to nocast type
nocast.c:35:39: warning: incorrect type in initializer (different modifiers)
nocast.c:35:39: expected unsigned long *static [toplevel] bad_ptr_from
-nocast.c:35:39: got unsigned long [nocast] *<noident>
+nocast.c:35:39: got unsigned long [nocast] *
nocast.c:35:39: warning: implicit cast from nocast type
nocast.c:50:16: warning: implicit cast from nocast type
nocast.c:54:16: warning: implicit cast from nocast type
diff --git a/validation/noderef.c b/validation/noderef.c
index 8c89f609..bcd6c08c 100644
--- a/validation/noderef.c
+++ b/validation/noderef.c
@@ -46,6 +46,6 @@ static void h(void)
* check-error-start
noderef.c:24:12: warning: incorrect type in assignment (different modifiers)
noderef.c:24:12: expected char *[noderef] *q2
-noderef.c:24:12: got char [noderef] **<noident>
+noderef.c:24:12: got char [noderef] **
* check-error-end
*/
diff --git a/validation/ptr-inherit.c b/validation/ptr-inherit.c
index 87330567..69e5a931 100644
--- a/validation/ptr-inherit.c
+++ b/validation/ptr-inherit.c
@@ -63,18 +63,18 @@ static void test_tls(void)
* check-error-start
ptr-inherit.c:12:19: warning: incorrect type in initializer (different modifiers)
ptr-inherit.c:12:19: expected int *p
-ptr-inherit.c:12:19: got int const *<noident>
+ptr-inherit.c:12:19: got int const *
ptr-inherit.c:18:19: warning: incorrect type in initializer (different modifiers)
ptr-inherit.c:18:19: expected int *p
-ptr-inherit.c:18:19: got int volatile *<noident>
+ptr-inherit.c:18:19: got int volatile *
ptr-inherit.c:24:19: warning: incorrect type in initializer (different modifiers)
ptr-inherit.c:24:19: expected int *p
-ptr-inherit.c:24:19: got int [noderef] *<noident>
+ptr-inherit.c:24:19: got int [noderef] *
ptr-inherit.c:30:19: warning: incorrect type in initializer (different base types)
ptr-inherit.c:30:19: expected int *p
-ptr-inherit.c:30:19: got restricted int *<noident>
+ptr-inherit.c:30:19: got restricted int *
ptr-inherit.c:36:19: warning: incorrect type in initializer (different address spaces)
ptr-inherit.c:36:19: expected int *p
-ptr-inherit.c:36:19: got int <asn:1> *<noident>
+ptr-inherit.c:36:19: got int <asn:1> *
* check-error-end
*/
diff --git a/validation/restrict.c b/validation/restrict.c
index f431f6d0..92bfdae8 100644
--- a/validation/restrict.c
+++ b/validation/restrict.c
@@ -73,19 +73,19 @@ restrict.c:11:6: error: symbol 'f02' redeclared with different type (originally
restrict.c:12:6: error: symbol 'f03' redeclared with different type (originally declared at restrict.c:4) - incompatible argument 1 (different modifiers)
restrict.c:33:13: warning: incorrect type in assignment (different modifiers)
restrict.c:33:13: expected void **extern [assigned] pup
-restrict.c:33:13: got void *const *<noident>
+restrict.c:33:13: got void *const *
restrict.c:34:13: warning: incorrect type in assignment (different modifiers)
restrict.c:34:13: expected void **extern [assigned] pup
restrict.c:34:13: got void *const *extern [assigned] pqp
restrict.c:48:13: warning: incorrect type in assignment (different modifiers)
restrict.c:48:13: expected void **extern [assigned] pup
-restrict.c:48:13: got void *restrict *<noident>
+restrict.c:48:13: got void *restrict *
restrict.c:49:13: warning: incorrect type in assignment (different modifiers)
restrict.c:49:13: expected void **extern [assigned] pup
restrict.c:49:13: got void *restrict *extern [assigned] prp
restrict.c:63:13: warning: incorrect type in assignment (different modifiers)
restrict.c:63:13: expected void **extern [assigned] pup
-restrict.c:63:13: got void *restrict *<noident>
+restrict.c:63:13: got void *restrict *
restrict.c:64:13: warning: incorrect type in assignment (different modifiers)
restrict.c:64:13: expected void **extern [assigned] pup
restrict.c:64:13: got void *restrict *extern [assigned] prp