diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-01-07 13:07:27 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-01-07 13:07:27 +0000 |
commit | 8af2cc9f404037fc70d217d328172e2f24f441eb (patch) | |
tree | ff3485d50708b2ecddcbeae8a2d8280f4999af6d /usr/src/tools/smatch/src/validation/constexpr-init.c | |
parent | 6fb307ce14869b1c3684d0948a7844194c69b5bd (diff) | |
parent | 9890ff8357a674572254e0be06b175a1e8eab4b0 (diff) | |
download | illumos-joyent-8af2cc9f404037fc70d217d328172e2f24f441eb.tar.gz |
[illumos-gate merge]
commit 9890ff8357a674572254e0be06b175a1e8eab4b0
10028 loader: implement framebuffer console
10029 common/font: create shared font.c
10030 import pnglite into usr/src/common/pnglite
8918 loader.efi: add vesa edid support
10031 loader: import tem for loader console
10032 loader: implement tem utf-8 support
10033 ficl: add simple gfx words
10034 loader: use term-drawrect for menu frame
10035 loader: add alpha blending for gfx_fb
10036 ficl: add fb-putimage
10037 loader: add illumos.png logo
10038 loader: replace gop and vesa with framebuffer
10039 loader: build rules for new font setup
10040 loader: gfx use GOP Blt() function in visual_io callbacks
commit f33b666290305a2b2c134d23cbd1e70e06bf36fd
7796 uts: ldterm default to utf-8
commit adc2b73db62a4506a57dfd1ce89bcadc4a60a29d
7784 uts: console input should support Unicode
commit 1f5207b7604fb44407eb4342aff613f7c4508508
10063 basic support for smatch
10153 checkpaths shouldn't check packaging exceptions
commit c0455f334914631f42eb41177d677e2820ee6506
9478 etdump: Add the etdump utility for dumping El Torito boot catalog information.
commit c62757b2b8b6c26589d7704d0ff20beb107fcd9a
10154 zfs: cast between incompatible function types
commit 781f142d2ae880bb893875d2a114552171a5c3e5
10064 loader: zfs reader should not probe partitionless disks
commit 8a06b3d6467c15646e663c05086378f16288af85
10155 ip: cast between incompatible function types
commit c5749750a3e052f1194f65a303456224c51dea63
10157 sgs/libld: cast between incompatible function types
commit 5e90af26eb6ed2206c2a5f5131a1f3c377d6e8c4
10158 sgs/rtld: cast between incompatible function types
commit adc04c2d55dd20cc6a0622f1147c0b084cdc3099
10159 libc: cast between incompatible function types
commit 9419bc2fc61b54b25a4e45211d31fcb920ff67cc
10162 Sun/Solaris/Kstat: cast between incompatible function types
Conflicts:
usr/src/tools/env/illumos.sh
Diffstat (limited to 'usr/src/tools/smatch/src/validation/constexpr-init.c')
-rw-r--r-- | usr/src/tools/smatch/src/validation/constexpr-init.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/usr/src/tools/smatch/src/validation/constexpr-init.c b/usr/src/tools/smatch/src/validation/constexpr-init.c new file mode 100644 index 0000000000..d7e7a450f5 --- /dev/null +++ b/usr/src/tools/smatch/src/validation/constexpr-init.c @@ -0,0 +1,60 @@ +static int a = 1; // OK +static int b[2] = {1, 1}; // OK +static void c(void) {} + +struct A { + int a; + int b[2]; +}; + +struct B { + int c; + struct A d; +}; + +static struct B d= {1, {1, {1, 1}}}; // OK +static struct B e= {a, {1, {1, 1}}}; // KO +static struct B f= {1, {a, {1, 1}}}; // KO +static struct B g= {1, {1, {a, 1}}}; // KO +static struct B h= {1, {1, {1, a}}}; // KO +static struct B i= {.c = 1, .d = {.a = 1, .b = {1, 1}}}; // OK +static struct B j= {.c = a, .d = {.a = 1, .b = {1, 1}}}; // KO +static struct B k= {.c = 1, .d = {.a = a, .b = {1, 1}}}; // KO +static struct B l= {.c = 1, .d = {.a = 1, .b = {a, 1}}}; // KO +static struct B m= {.c = 1, .d = {.a = 1, .b = {1, a}}}; // KO + +static int n[] = {a, 1}; // KO +static int o[] = {1, a}; // KO +static int p[] = {[0] = a, [1] = 1}; // KO +static int q[] = {[0] = 1, [1] = a}; // KO + +static void r(void) { + int a = 0; + int b = a; // OK +} + +static void s(void) { + int a = 1; + static int b = a; // KO +} + +/* + * check-name: static storage object initializer constness verification. + * check-command: sparse -Wconstexpr-not-const $file + * + * check-error-start +constexpr-init.c:16:21: warning: non-constant initializer for static object +constexpr-init.c:17:25: warning: non-constant initializer for static object +constexpr-init.c:18:29: warning: non-constant initializer for static object +constexpr-init.c:19:32: warning: non-constant initializer for static object +constexpr-init.c:21:26: warning: non-constant initializer for static object +constexpr-init.c:22:40: warning: non-constant initializer for static object +constexpr-init.c:23:49: warning: non-constant initializer for static object +constexpr-init.c:24:52: warning: non-constant initializer for static object +constexpr-init.c:26:19: warning: non-constant initializer for static object +constexpr-init.c:27:22: warning: non-constant initializer for static object +constexpr-init.c:28:25: warning: non-constant initializer for static object +constexpr-init.c:29:34: warning: non-constant initializer for static object +constexpr-init.c:38:24: warning: non-constant initializer for static object + * check-error-end + */ |