adlint 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,8 @@ static int a6[3]();
18
18
  static int a7[3](int);
19
19
  static int (*a8[3])(long);
20
20
 
21
+ extern enum Baz baz1;
22
+
21
23
  void foo(const union Bar *p1, const union Bar * const p2)
22
24
  {
23
25
  *p1 = *p2;
@@ -46,4 +48,5 @@ void baz(void)
46
48
  const void v2;
47
49
  int i1;
48
50
  const int i2;
51
+ const enum Baz baz2;
49
52
  }
@@ -1,7 +1,6 @@
1
- extern long foo(void);
2
- extern unsigned long bar(void);
1
+ extern int rand(void);
3
2
 
4
- static void baz(void)
3
+ static void foo(void)
5
4
  {
6
5
  const int i = rand();
7
6
 
@@ -28,10 +27,65 @@ static void baz(void)
28
27
  }
29
28
  }
30
29
 
30
+ extern void *alloc(void);
31
+
32
+ static void bar(void)
33
+ {
34
+ const signed char sc1 = (signed char) 127.5;
35
+ const signed char sc2 = (signed char) 128.5;
36
+
37
+ const signed char sc3 = (signed char) -128.5;
38
+ const signed char sc4 = (signed char) -129.5;
39
+
40
+ const unsigned char uc1 = (unsigned char) 255.5;
41
+ const unsigned char uc2 = (unsigned char) 256.5;
42
+
43
+ const unsigned char uc3 = (unsigned char) 0.5;
44
+ const unsigned char uc4 = (unsigned char) -1.5;
45
+
46
+ const int si1 = (int) 1.5e9;
47
+ const int si2 = (int) 1.5e10;
48
+
49
+ const int si3 = (int) -1.5e9;
50
+ const int si3 = (int) -1.5e10;
51
+
52
+ int *data_ptr = (int *) alloc();
53
+ int (*func_ptr)(void) = (int (*)(void)) alloc();
54
+
55
+ const unsigned char uc5 = (unsigned char) data_ptr;
56
+ const unsigned char uc6 = (unsigned char) func_ptr;
57
+
58
+ const unsigned short us1 = (unsigned short) data_ptr;
59
+ const unsigned short us2 = (unsigned short) func_ptr;
60
+
61
+ const unsigned int ui1 = (unsigned int) data_ptr;
62
+ const unsigned int ui2 = (unsigned int) func_ptr;
63
+
64
+ const unsigned long ul1 = (unsigned long) data_ptr;
65
+ const unsigned long ul2 = (unsigned long) func_ptr;
66
+
67
+ const unsigned char uc7 = 255;
68
+ const unsigned char uc8 = 256;
69
+
70
+ const unsigned int ui3 = 4294967295;
71
+ const unsigned int ui4 = 4294967296;
72
+
73
+ const unsigned char a[] = { 255, 256 };
74
+
75
+ const signed char sc5 = 127;
76
+ const signed char sc6 = 128;
77
+
78
+ const int si4 = 2147483647;
79
+ const int si5 = 2147483648;
80
+ }
81
+
82
+ extern long baz(void);
83
+ extern unsigned long qux(void);
84
+
31
85
  int main(void)
32
86
  {
33
- const long l = foo();
34
- const unsigned long ul = bar();
87
+ const long l = baz();
88
+ const unsigned long ul = qux();
35
89
  long r;
36
90
 
37
91
  r = 0x1FFFFFFFL << 1;
@@ -11,6 +11,19 @@ union foo {
11
11
  unsigned short s;
12
12
  };
13
13
 
14
+ union bar {
15
+ unsigned int a;
16
+ float b;
17
+ };
18
+
19
+ struct baz {
20
+ union {
21
+ unsigned long a;
22
+ double b;
23
+ } u;
24
+ unsigned long a;
25
+ };
26
+
14
27
  int main(void)
15
28
  {
16
29
  struct event e1;
@@ -0,0 +1,13 @@
1
+ struct foo {
2
+ unsigned int b0:1;
3
+ unsigned int :1;
4
+ unsigned int :1;
5
+ unsigned int b3:1;
6
+ };
7
+
8
+ struct bar {
9
+ int;
10
+ int :1;
11
+ long;
12
+ double;
13
+ };
@@ -34,3 +34,46 @@ qux
34
34
  {
35
35
  return (struct hoge *) i;
36
36
  }
37
+
38
+ extern const int ansi_qualified_func_1(const int);
39
+ const int ansi_qualified_func_1(const int i)
40
+ {
41
+ return i * 2;
42
+ }
43
+
44
+ extern const int kandr_qualified_func_1();
45
+ const int kandr_qualified_func_1(i)
46
+ const int i;
47
+ {
48
+ return i * 2;
49
+ }
50
+
51
+ static volatile ansi_qualified_func_2(const int);
52
+ static volatile ansi_qualified_func_2(const int i)
53
+ {
54
+ return i * 2;
55
+ }
56
+
57
+ static volatile kandr_qualified_func_2();
58
+ static volatile kandr_qualified_func_2(i)
59
+ const int i;
60
+ {
61
+ return i * 2;
62
+ }
63
+
64
+ const int *ansi_func(const int);
65
+ const int *ansi_func(const int i)
66
+ {
67
+ static int j;
68
+ j = i;
69
+ return &j;
70
+ }
71
+
72
+ const int *kandr_func();
73
+ const int *kandr_func(i)
74
+ const int i;
75
+ {
76
+ static int j;
77
+ j = i;
78
+ return &j;
79
+ }
@@ -1,38 +1,112 @@
1
- static void foo(const unsigned int ui)
1
+ static void foo(const int i, const unsigned int ui)
2
2
  {
3
- unsigned int r;
3
+ {
4
+ int r;
4
5
 
5
- if (ui > 3000000000U) {
6
- r = ui * 5U;
7
- r = ui + ui;
6
+ if (i > 2000000000) {
7
+ r = i * 5;
8
+ r = i + i;
9
+ }
8
10
  }
9
- else {
10
- r = ui - 4000000000U;
11
+
12
+ {
13
+ unsigned int r;
14
+
15
+ if (ui > 3000000000U) {
16
+ r = ui * 5U;
17
+ r = ui + ui;
18
+ }
19
+ else {
20
+ r = ui - 4000000000U;
21
+ }
11
22
  }
12
23
  }
13
24
 
14
- static void bar(const unsigned int ui)
25
+ static void bar(const int i, const unsigned int ui)
15
26
  {
16
- unsigned int r;
27
+ {
28
+ int r;
17
29
 
18
- if (ui > 1000U) {
19
- r = ui * 5U;
20
- r = ui + ui;
30
+ if (i > 1000) {
31
+ r = i * 5;
32
+ r = i + i;
33
+ }
21
34
  }
22
- else {
23
- r = ui - 1000U;
35
+
36
+ {
37
+ unsigned int r;
38
+
39
+ if (ui > 1000U) {
40
+ r = ui * 5U;
41
+ r = ui + ui;
42
+ }
43
+ else {
44
+ r = ui - 1000U;
45
+ }
24
46
  }
25
47
  }
26
48
 
27
- static void baz(const char uc)
49
+ static void baz(const signed char c, const unsigned char uc)
28
50
  {
29
- unsigned char r;
51
+ {
52
+ signed char r;
53
+
54
+ if (c > 125) {
55
+ r = c * 5;
56
+ r = c + c;
57
+ }
58
+ }
30
59
 
31
- if (uc > 128U) {
32
- r = uc * 5U;
33
- r = uc + ui;
60
+ {
61
+ unsigned char r;
62
+
63
+ if (uc > 128U) {
64
+ r = uc * 5U;
65
+ r = uc + uc;
66
+ }
67
+ else {
68
+ r = uc - 128U;
69
+ }
34
70
  }
35
- else {
36
- r = uc - 128U;
71
+ }
72
+
73
+ static void qux(const unsigned int ui)
74
+ {
75
+ {
76
+ const unsigned int ui1 = 3U - 1U;
77
+ const unsigned int ui2 = 3U - 3U;
78
+ const unsigned int ui3 = 3U - 5U;
79
+
80
+ unsigned int ui4;
81
+
82
+ ui4 = 3U - 1U;
83
+ ui4 = 3U - 3U;
84
+ ui4 = 3U - 5U;
85
+
86
+ ui4 = ui - 1U;
87
+ }
88
+
89
+ {
90
+ const unsigned int ui1 = 4294967294U + 1U;
91
+ const unsigned int ui2 = 4294967295U + 1U;
92
+
93
+ unsigned int ui3;
94
+
95
+ ui3 = 4294967294U + 1U;
96
+ ui3 = 4294967295U + 1U;
97
+
98
+ ui3 = ui + 1U;
99
+ }
100
+
101
+ {
102
+ const unsigned int ui1 = 2000000000U * 2U;
103
+ const unsigned int ui2 = 3000000000U * 2U;
104
+
105
+ unsigned int ui3;
106
+
107
+ ui3 = 2000000000U * 2U;
108
+ ui3 = 3000000000U * 2U;
109
+
110
+ ui3 = ui * 2U;
37
111
  }
38
112
  }
@@ -1,8 +1,8 @@
1
1
  <html lang="ja">
2
2
  <head>
3
- <title>AdLint 1.2.0 開発者ガイド</title>
3
+ <title>AdLint 1.4.0 開発者ガイド</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.2.0 開発者ガイド">
5
+ <meta name="description" content="AdLint 1.4.0 開発者ガイド">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.2.0 開発者ガイド</h1>
47
+ <h1 class="settitle">AdLint 1.4.0 開発者ガイド</h1>
48
48
  <div class="contents">
49
49
  <h2>Table of Contents</h2>
50
50
  <ul>
@@ -2,7 +2,7 @@
2
2
  @setfilename developers_guide_ja.info
3
3
  @documentlanguage ja
4
4
  @documentencoding utf-8
5
- @settitle AdLint 1.2.0 開発者ガイド
5
+ @settitle AdLint 1.4.0 開発者ガイド
6
6
 
7
7
  @copying
8
8
  Copyright (C) 2010-2012, OGIS-RI Co.,Ltd.
@@ -1,8 +1,8 @@
1
1
  <html lang="en">
2
2
  <head>
3
- <title>AdLint 1.2.0 User's Guide</title>
3
+ <title>AdLint 1.4.0 User's Guide</title>
4
4
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
- <meta name="description" content="AdLint 1.2.0 User's Guide">
5
+ <meta name="description" content="AdLint 1.4.0 User's Guide">
6
6
  <meta name="generator" content="makeinfo 4.13">
7
7
  <link title="Top" rel="top" href="#Top">
8
8
  <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
@@ -44,7 +44,7 @@ td { border: 1px solid black; }
44
44
  --></style>
45
45
  </head>
46
46
  <body>
47
- <h1 class="settitle">AdLint 1.2.0 User's Guide</h1>
47
+ <h1 class="settitle">AdLint 1.4.0 User's Guide</h1>
48
48
  <div class="node">
49
49
  <a name="Top"></a>
50
50
  <p><hr>
@@ -2682,7 +2682,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Top">Top</a>
2682
2682
  <li><a href="#W0722">W0722</a>: A value of signed statement is overflow.
2683
2683
  <li><a href="#W0723">W0723</a>: A value of signed statement might be overflow.
2684
2684
  <li><a href="#W0724">W0724</a>: An unrecognized preprocessing directive is ignored by conditional include directive.
2685
- <li><a href="#W0726">W0726</a>: A function `%s()' which return value is declared as qualified void type , `return statement;' is found.
2685
+ <li><a href="#W0726">W0726</a>: A function `%s()' which return value is declared as qualified void type, `return expression;' is found.
2686
2686
  <li><a href="#W0727">W0727</a>: The value not part of the enumeration type is used.
2687
2687
  <li><a href="#W0728">W0728</a>: Other enumeration literal of enumeration type is passed to enumeration literal of formal argument as actual argument.
2688
2688
  <li><a href="#W0729">W0729</a>: An enumeration literal of the other enumeration type is substituted for enumeration type object.
@@ -29240,13 +29240,14 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
29240
29240
 
29241
29241
  <h4 class="subsection">6.497.2 Content</h4>
29242
29242
 
29243
- <p><b>This message will be supported in AdLint 2.0.0</b>
29244
-
29245
- <p>Under construction.
29243
+ <p>Under construction.
29246
29244
 
29247
29245
  <h4 class="subsection">6.497.3 Sample code</h4>
29248
29246
 
29249
- <pre class="verbatim">/* will be added */
29247
+ <pre class="verbatim">union UNI { /* W0606 */
29248
+ float a;
29249
+ int b;
29250
+ };
29250
29251
  </pre>
29251
29252
 
29252
29253
  <h4 class="subsection">6.497.4 Related message</h4>
@@ -29255,7 +29256,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
29255
29256
 
29256
29257
  <h4 class="subsection">6.497.5 Since</h4>
29257
29258
 
29258
- <p>2.0.0 (planned)
29259
+ <p>1.4.0
29259
29260
 
29260
29261
  <div class="node">
29261
29262
  <a name="W0607"></a>
@@ -32975,9 +32976,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
32975
32976
 
32976
32977
  <h4 class="subsection">6.565.2 Content</h4>
32977
32978
 
32978
- <p><b>This message will be supported in AdLint 2.0.0</b>
32979
-
32980
- <p>Under construction.
32979
+ <p>Under construction.
32981
32980
 
32982
32981
  <h4 class="subsection">6.565.3 Sample code</h4>
32983
32982
 
@@ -32995,7 +32994,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
32995
32994
 
32996
32995
  <h4 class="subsection">6.565.5 Since</h4>
32997
32996
 
32998
- <p>2.0.0 (planned)
32997
+ <p>1.4.0
32999
32998
 
33000
32999
  <div class="node">
33001
33000
  <a name="W0688"></a>
@@ -33290,16 +33289,12 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
33290
33289
 
33291
33290
  <h4 class="subsection">6.573.2 Content</h4>
33292
33291
 
33293
- <p><b>This message will be supported in AdLint 2.0.0</b>
33294
-
33295
- <p>Under construction.
33292
+ <p>Under construction.
33296
33293
 
33297
33294
  <h4 class="subsection">6.573.3 Sample code</h4>
33298
33295
 
33299
33296
  <pre class="verbatim">#undef assert /* W0695 */
33300
- void assert(int a)
33301
- {
33302
- }
33297
+ extern void assert(int a);
33303
33298
  </pre>
33304
33299
 
33305
33300
  <h4 class="subsection">6.573.4 Related message</h4>
@@ -33308,7 +33303,7 @@ void assert(int a)
33308
33303
 
33309
33304
  <h4 class="subsection">6.573.5 Since</h4>
33310
33305
 
33311
- <p>2.0.0 (planned)
33306
+ <p>1.4.0
33312
33307
 
33313
33308
  <div class="node">
33314
33309
  <a name="W0696"></a>
@@ -33419,13 +33414,14 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
33419
33414
 
33420
33415
  <h4 class="subsection">6.576.2 Content</h4>
33421
33416
 
33422
- <p><b>This message will be supported in AdLint 2.0.0</b>
33423
-
33424
- <p>Under construction.
33417
+ <p>Under construction.
33425
33418
 
33426
33419
  <h4 class="subsection">6.576.3 Sample code</h4>
33427
33420
 
33428
- <pre class="verbatim">/* will be added */
33421
+ <pre class="verbatim">int func(void)
33422
+ {
33423
+ return; /* W0698 */
33424
+ }
33429
33425
  </pre>
33430
33426
 
33431
33427
  <h4 class="subsection">6.576.4 Related message</h4>
@@ -33438,7 +33434,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
33438
33434
 
33439
33435
  <h4 class="subsection">6.576.5 Since</h4>
33440
33436
 
33441
- <p>2.0.0 (planned)
33437
+ <p>1.4.0
33442
33438
 
33443
33439
  <div class="node">
33444
33440
  <a name="W0699"></a>
@@ -33459,13 +33455,14 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
33459
33455
 
33460
33456
  <h4 class="subsection">6.577.2 Content</h4>
33461
33457
 
33462
- <p><b>This message will be supported in AdLint 2.0.0</b>
33463
-
33464
- <p>Under construction.
33458
+ <p>Under construction.
33465
33459
 
33466
33460
  <h4 class="subsection">6.577.3 Sample code</h4>
33467
33461
 
33468
- <pre class="verbatim">/* will be added */
33462
+ <pre class="verbatim">extern func(void)
33463
+ {
33464
+ return; /* W0699 */
33465
+ }
33469
33466
  </pre>
33470
33467
 
33471
33468
  <h4 class="subsection">6.577.4 Related message</h4>
@@ -33478,7 +33475,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
33478
33475
 
33479
33476
  <h4 class="subsection">6.577.5 Since</h4>
33480
33477
 
33481
- <p>2.0.0 (planned)
33478
+ <p>1.4.0
33482
33479
 
33483
33480
  <div class="node">
33484
33481
  <a name="W0700"></a>
@@ -34105,13 +34102,15 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34105
34102
 
34106
34103
  <h4 class="subsection">6.593.2 Content</h4>
34107
34104
 
34108
- <p><b>This message will be supported in AdLint 2.0.0</b>
34109
-
34110
- <p>Under construction.
34105
+ <p>Under construction.
34111
34106
 
34112
34107
  <h4 class="subsection">6.593.3 Sample code</h4>
34113
34108
 
34114
- <pre class="verbatim">/* will be added */
34109
+ <pre class="verbatim">signed char sc1 = (signed char) 127.5; /* OK */
34110
+ signed char sc2 = (signed char) 128.5; /* W0720 */
34111
+
34112
+ signed char sc3 = (signed char) -128.5; /* OK */
34113
+ signed char sc4 = (signed char) -129.5; /* W0720 */
34115
34114
  </pre>
34116
34115
 
34117
34116
  <h4 class="subsection">6.593.4 Related message</h4>
@@ -34120,7 +34119,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34120
34119
 
34121
34120
  <h4 class="subsection">6.593.5 Since</h4>
34122
34121
 
34123
- <p>2.0.0 (planned)
34122
+ <p>1.4.0
34124
34123
 
34125
34124
  <div class="node">
34126
34125
  <a name="W0721"></a>
@@ -34141,14 +34140,15 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34141
34140
 
34142
34141
  <h4 class="subsection">6.594.2 Content</h4>
34143
34142
 
34144
- <p><b>This message will be supported in AdLint 2.0.0</b>
34145
-
34146
- <p>Under construction.
34143
+ <p>Under construction.
34147
34144
 
34148
34145
  <h4 class="subsection">6.594.3 Sample code</h4>
34149
34146
 
34150
- <pre class="verbatim">unsigned char* p;
34151
- unsigned short us = (unsigned short) p; /* W0721 */
34147
+ <pre class="verbatim">void func(int *p)
34148
+ {
34149
+ /* when short is 16 bit long and pointer is 32 bit long */
34150
+ unsigned short us = (unsigned short) p; /* W0721 */
34151
+ }
34152
34152
  </pre>
34153
34153
 
34154
34154
  <h4 class="subsection">6.594.4 Related message</h4>
@@ -34157,7 +34157,7 @@ unsigned short us = (unsigned short) p; /* W0721 */
34157
34157
 
34158
34158
  <h4 class="subsection">6.594.5 Since</h4>
34159
34159
 
34160
- <p>2.0.0 (planned)
34160
+ <p>1.4.0
34161
34161
 
34162
34162
  <div class="node">
34163
34163
  <a name="W0722"></a>
@@ -34178,16 +34178,18 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34178
34178
 
34179
34179
  <h4 class="subsection">6.595.2 Content</h4>
34180
34180
 
34181
- <p><b>This message will be supported in AdLint 2.0.0</b>
34182
-
34183
- <p>Under construction.
34181
+ <p>Under construction.
34184
34182
 
34185
34183
  <h4 class="subsection">6.595.3 Sample code</h4>
34186
34184
 
34187
- <pre class="verbatim">int func(int a) /* int type is 32 bit long */
34185
+ <pre class="verbatim">int func(int a)
34188
34186
  {
34189
- if (a > 0 &amp;&amp; a &lt; 2147483647) {
34190
- return a + 1;
34187
+ /* when int is 32 bit long */
34188
+ if (a &lt; 0) {
34189
+ return a + 1; /* OK */
34190
+ }
34191
+ else if (a &lt; 2147483647) {
34192
+ return a + 1; /* OK */
34191
34193
  }
34192
34194
 
34193
34195
  return a + 1; /* W0722 */
@@ -34202,7 +34204,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34202
34204
 
34203
34205
  <h4 class="subsection">6.595.5 Since</h4>
34204
34206
 
34205
- <p>2.0.0 (planned)
34207
+ <p>1.4.0
34206
34208
 
34207
34209
  <div class="node">
34208
34210
  <a name="W0723"></a>
@@ -34223,13 +34225,22 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34223
34225
 
34224
34226
  <h4 class="subsection">6.596.2 Content</h4>
34225
34227
 
34226
- <p><b>This message will be supported in AdLint 2.0.0</b>
34227
-
34228
- <p>Under construction.
34228
+ <p>Under construction.
34229
34229
 
34230
34230
  <h4 class="subsection">6.596.3 Sample code</h4>
34231
34231
 
34232
- <pre class="verbatim">/* will be added */
34232
+ <pre class="verbatim">int func(int a)
34233
+ {
34234
+ /* when int is 32 bit long */
34235
+ if (a &lt; 0) {
34236
+ return a + 1; /* OK */
34237
+ }
34238
+ else if (a &lt; 2000000000) {
34239
+ return a + 1; /* OK */
34240
+ }
34241
+
34242
+ return a + 1; /* W0723 */
34243
+ }
34233
34244
  </pre>
34234
34245
 
34235
34246
  <h4 class="subsection">6.596.4 Related message</h4>
@@ -34240,7 +34251,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34240
34251
 
34241
34252
  <h4 class="subsection">6.596.5 Since</h4>
34242
34253
 
34243
- <p>2.0.0 (planned)
34254
+ <p>1.4.0
34244
34255
 
34245
34256
  <div class="node">
34246
34257
  <a name="W0724"></a>
@@ -34293,19 +34304,17 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34293
34304
 
34294
34305
  <h4 class="subsection">6.598.1 Message body</h4>
34295
34306
 
34296
- <p>A function `%s()' which return value is declared as qualified void type , `return statement;' is found.
34307
+ <p>A function `%s()' which return value is declared as qualified void type, `return expression;' is found.
34297
34308
 
34298
34309
  <h4 class="subsection">6.598.2 Content</h4>
34299
34310
 
34300
- <p><b>This message will be supported in AdLint 2.0.0</b>
34301
-
34302
- <p>Under construction.
34311
+ <p>Under construction.
34303
34312
 
34304
34313
  <h4 class="subsection">6.598.3 Sample code</h4>
34305
34314
 
34306
- <pre class="verbatim">void func(int a)
34315
+ <pre class="verbatim">const void func(int a)
34307
34316
  {
34308
- if(a == 0) {
34317
+ if (a == 0) {
34309
34318
  return 0; /* W0726 */
34310
34319
  }
34311
34320
  }
@@ -34317,7 +34326,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34317
34326
 
34318
34327
  <h4 class="subsection">6.598.5 Since</h4>
34319
34328
 
34320
- <p>2.0.0 (planned)
34329
+ <p>1.4.0
34321
34330
 
34322
34331
  <div class="node">
34323
34332
  <a name="W0727"></a>
@@ -34338,17 +34347,17 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34338
34347
 
34339
34348
  <h4 class="subsection">6.599.2 Content</h4>
34340
34349
 
34341
- <p><b>This message will be supported in AdLint 2.0.0</b>
34342
-
34343
- <p>Under construction.
34350
+ <p>Under construction.
34344
34351
 
34345
34352
  <h4 class="subsection">6.599.3 Sample code</h4>
34346
34353
 
34347
34354
  <pre class="verbatim">enum Fruits {
34348
- apple = 1,
34349
- banana,
34350
- orange
34355
+ APPLE = 1,
34356
+ BANANA,
34357
+ ORANGE
34351
34358
  };
34359
+
34360
+ enum Fruits fruit = 5; /* W0727 */
34352
34361
  </pre>
34353
34362
 
34354
34363
  <h4 class="subsection">6.599.4 Related message</h4>
@@ -34362,7 +34371,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34362
34371
 
34363
34372
  <h4 class="subsection">6.599.5 Since</h4>
34364
34373
 
34365
- <p>2.0.0 (planned)
34374
+ <p>1.4.0
34366
34375
 
34367
34376
  <div class="node">
34368
34377
  <a name="W0728"></a>
@@ -34383,13 +34392,19 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34383
34392
 
34384
34393
  <h4 class="subsection">6.600.2 Content</h4>
34385
34394
 
34386
- <p><b>This message will be supported in AdLint 2.0.0</b>
34387
-
34388
- <p>Under construction.
34395
+ <p>Under construction.
34389
34396
 
34390
34397
  <h4 class="subsection">6.600.3 Sample code</h4>
34391
34398
 
34392
- <pre class="verbatim">/* will be added */
34399
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
34400
+ enum Fruits { APPLE, BANANA, ORANGE };
34401
+
34402
+ extern void func1(enum Color);
34403
+
34404
+ void func2(void)
34405
+ {
34406
+ func1(ORANGE); /* W0728 */
34407
+ }
34393
34408
  </pre>
34394
34409
 
34395
34410
  <h4 class="subsection">6.600.4 Related message</h4>
@@ -34403,7 +34418,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34403
34418
 
34404
34419
  <h4 class="subsection">6.600.5 Since</h4>
34405
34420
 
34406
- <p>2.0.0 (planned)
34421
+ <p>1.4.0
34407
34422
 
34408
34423
  <div class="node">
34409
34424
  <a name="W0729"></a>
@@ -34424,13 +34439,19 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34424
34439
 
34425
34440
  <h4 class="subsection">6.601.2 Content</h4>
34426
34441
 
34427
- <p><b>This message will be supported in AdLint 2.0.0</b>
34428
-
34429
- <p>Under construction.
34442
+ <p>Under construction.
34430
34443
 
34431
34444
  <h4 class="subsection">6.601.3 Sample code</h4>
34432
34445
 
34433
- <pre class="verbatim">/* will be added */
34446
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
34447
+ enum Fruits { APPLE, BANANA, ORANGE };
34448
+
34449
+ void func(void)
34450
+ {
34451
+ enum Color c;
34452
+
34453
+ c = ORANGE; /* W0729 */
34454
+ }
34434
34455
  </pre>
34435
34456
 
34436
34457
  <h4 class="subsection">6.601.4 Related message</h4>
@@ -34444,7 +34465,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34444
34465
 
34445
34466
  <h4 class="subsection">6.601.5 Since</h4>
34446
34467
 
34447
- <p>2.0.0 (planned)
34468
+ <p>1.4.0
34448
34469
 
34449
34470
  <div class="node">
34450
34471
  <a name="W0730"></a>
@@ -34465,13 +34486,17 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34465
34486
 
34466
34487
  <h4 class="subsection">6.602.2 Content</h4>
34467
34488
 
34468
- <p><b>This message will be supported in AdLint 2.0.0</b>
34469
-
34470
- <p>Under construction.
34489
+ <p>Under construction.
34471
34490
 
34472
34491
  <h4 class="subsection">6.602.3 Sample code</h4>
34473
34492
 
34474
- <pre class="verbatim">/* will be added */
34493
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
34494
+ enum Fruits { APPLE, BANANA, ORANGE };
34495
+
34496
+ enum Color func(void)
34497
+ {
34498
+ return ORANGE; /* W0730 */
34499
+ }
34475
34500
  </pre>
34476
34501
 
34477
34502
  <h4 class="subsection">6.602.4 Related message</h4>
@@ -34485,7 +34510,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34485
34510
 
34486
34511
  <h4 class="subsection">6.602.5 Since</h4>
34487
34512
 
34488
- <p>2.0.0 (planned)
34513
+ <p>1.4.0
34489
34514
 
34490
34515
  <div class="node">
34491
34516
  <a name="W0731"></a>
@@ -34506,13 +34531,24 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34506
34531
 
34507
34532
  <h4 class="subsection">6.603.2 Content</h4>
34508
34533
 
34509
- <p><b>This message will be supported in AdLint 2.0.0</b>
34510
-
34511
- <p>Under construction.
34534
+ <p>Under construction.
34512
34535
 
34513
34536
  <h4 class="subsection">6.603.3 Sample code</h4>
34514
34537
 
34515
- <pre class="verbatim">/* will be added */
34538
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
34539
+ enum Fruits { APPLE, BANANA, ORANGE, GRAPE };
34540
+
34541
+ int func(enum Color c)
34542
+ {
34543
+ switch (c) {
34544
+ case RED:
34545
+ return 1;
34546
+ case GRAPE: /* W0731 */
34547
+ return 2;
34548
+ }
34549
+
34550
+ return 0;
34551
+ }
34516
34552
  </pre>
34517
34553
 
34518
34554
  <h4 class="subsection">6.603.4 Related message</h4>
@@ -34526,7 +34562,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34526
34562
 
34527
34563
  <h4 class="subsection">6.603.5 Since</h4>
34528
34564
 
34529
- <p>2.0.0 (planned)
34565
+ <p>1.4.0
34530
34566
 
34531
34567
  <div class="node">
34532
34568
  <a name="W0732"></a>
@@ -34751,13 +34787,11 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34751
34787
 
34752
34788
  <h4 class="subsection">6.609.2 Content</h4>
34753
34789
 
34754
- <p><b>This message will be supported in AdLint 2.0.0</b>
34755
-
34756
- <p>Under construction.
34790
+ <p>Under construction.
34757
34791
 
34758
34792
  <h4 class="subsection">6.609.3 Sample code</h4>
34759
34793
 
34760
- <pre class="verbatim">/* will be added */
34794
+ <pre class="verbatim">extern enum Foo foo; /* W0737 */
34761
34795
  </pre>
34762
34796
 
34763
34797
  <h4 class="subsection">6.609.4 Related message</h4>
@@ -34766,7 +34800,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34766
34800
 
34767
34801
  <h4 class="subsection">6.609.5 Since</h4>
34768
34802
 
34769
- <p>2.0.0 (planned)
34803
+ <p>1.4.0
34770
34804
 
34771
34805
  <div class="node">
34772
34806
  <a name="W0738"></a>
@@ -34787,13 +34821,17 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34787
34821
 
34788
34822
  <h4 class="subsection">6.610.2 Content</h4>
34789
34823
 
34790
- <p><b>This message will be supported in AdLint 2.0.0</b>
34791
-
34792
- <p>Under construction.
34824
+ <p>Under construction.
34793
34825
 
34794
34826
  <h4 class="subsection">6.610.3 Sample code</h4>
34795
34827
 
34796
- <pre class="verbatim">unsigned char uc = 500; /* W0738 */
34828
+ <pre class="verbatim">/* when char is 8 bit long */
34829
+ const unsigned char uc1 = 255; /* OK */
34830
+ const unsigned char uc2 = 256; /* W0738 */
34831
+
34832
+ /* when int is 32 bit long */
34833
+ const unsigned int ui1 = 4294967295; /* OK */
34834
+ const unsigned int ui2 = 4294967296; /* W0738 */
34797
34835
  </pre>
34798
34836
 
34799
34837
  <h4 class="subsection">6.610.4 Related message</h4>
@@ -34802,7 +34840,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34802
34840
 
34803
34841
  <h4 class="subsection">6.610.5 Since</h4>
34804
34842
 
34805
- <p>2.0.0 (planned)
34843
+ <p>1.4.0
34806
34844
 
34807
34845
  <div class="node">
34808
34846
  <a name="W0739"></a>
@@ -34823,13 +34861,12 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34823
34861
 
34824
34862
  <h4 class="subsection">6.611.2 Content</h4>
34825
34863
 
34826
- <p><b>This message will be supported in AdLint 2.0.0</b>
34827
-
34828
- <p>Under construction.
34864
+ <p>Under construction.
34829
34865
 
34830
34866
  <h4 class="subsection">6.611.3 Sample code</h4>
34831
34867
 
34832
- <pre class="verbatim">unsigned int ui = 5U - 10U; /* W0739 */
34868
+ <pre class="verbatim">const unsigned int ui1 = 3U - 3U; /* OK */
34869
+ const unsigned int ui2 = 3U - 5U; /* W0739 */
34833
34870
  </pre>
34834
34871
 
34835
34872
  <h4 class="subsection">6.611.4 Related message</h4>
@@ -34841,7 +34878,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34841
34878
 
34842
34879
  <h4 class="subsection">6.611.5 Since</h4>
34843
34880
 
34844
- <p>2.0.0 (planned)
34881
+ <p>1.4.0
34845
34882
 
34846
34883
  <div class="node">
34847
34884
  <a name="W0740"></a>
@@ -34862,15 +34899,13 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34862
34899
 
34863
34900
  <h4 class="subsection">6.612.2 Content</h4>
34864
34901
 
34865
- <p><b>This message will be supported in AdLint 2.0.0</b>
34866
-
34867
- <p>Under construction.
34902
+ <p>Under construction.
34868
34903
 
34869
34904
  <h4 class="subsection">6.612.3 Sample code</h4>
34870
34905
 
34871
- <pre class="verbatim">#define MACRO (255)
34872
-
34873
- unsigned char uc = MACRO + 10; /* W0740 */
34906
+ <pre class="verbatim">/* when int is 32 bit long */
34907
+ const unsigned int ui1 = 4294967294U + 1U; /* OK */
34908
+ const unsigned int ui2 = 4294967295U + 1U; /* W0740 */
34874
34909
  </pre>
34875
34910
 
34876
34911
  <h4 class="subsection">6.612.4 Related message</h4>
@@ -34882,7 +34917,7 @@ unsigned char uc = MACRO + 10; /* W0740 */
34882
34917
 
34883
34918
  <h4 class="subsection">6.612.5 Since</h4>
34884
34919
 
34885
- <p>2.0.0 (planned)
34920
+ <p>1.4.0
34886
34921
 
34887
34922
  <div class="node">
34888
34923
  <a name="W0741"></a>
@@ -34903,13 +34938,13 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34903
34938
 
34904
34939
  <h4 class="subsection">6.613.2 Content</h4>
34905
34940
 
34906
- <p><b>This message will be supported in AdLint 2.0.0</b>
34907
-
34908
- <p>Under construction.
34941
+ <p>Under construction.
34909
34942
 
34910
34943
  <h4 class="subsection">6.613.3 Sample code</h4>
34911
34944
 
34912
- <pre class="verbatim">/* will be added */
34945
+ <pre class="verbatim">/* when int is 32 bit long */
34946
+ const unsigned int ui1 = 2000000000U * 2U; /* OK */
34947
+ const unsigned int ui2 = 3000000000U * 2U; /* W0741 */
34913
34948
  </pre>
34914
34949
 
34915
34950
  <h4 class="subsection">6.613.4 Related message</h4>
@@ -34921,7 +34956,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34921
34956
 
34922
34957
  <h4 class="subsection">6.613.5 Since</h4>
34923
34958
 
34924
- <p>2.0.0 (planned)
34959
+ <p>1.4.0
34925
34960
 
34926
34961
  <div class="node">
34927
34962
  <a name="W0742"></a>
@@ -34980,17 +35015,17 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
34980
35015
 
34981
35016
  <h4 class="subsection">6.615.2 Content</h4>
34982
35017
 
34983
- <p><b>This message will be supported in AdLint 2.0.0</b>
34984
-
34985
- <p>Under construction.
35018
+ <p>Under construction.
34986
35019
 
34987
35020
  <h4 class="subsection">6.615.3 Sample code</h4>
34988
35021
 
34989
- <pre class="verbatim">#define MACRO (255)
35022
+ <pre class="verbatim">/* when char is 8 bit long */
35023
+ const signed char sc1 = 127; /* OK */
35024
+ const signed char sc2 = 128; /* W0743 */
34990
35025
 
34991
- signed char sc;
34992
-
34993
- sc = MACRO + 150; /* W0743 */
35026
+ /* when int is 32 bit long */
35027
+ const int si1 = 2147483647; /* OK */
35028
+ const int si2 = 2147483648; /* W0743 */
34994
35029
  </pre>
34995
35030
 
34996
35031
  <h4 class="subsection">6.615.4 Related message</h4>
@@ -34999,7 +35034,7 @@ sc = MACRO + 150; /* W0743 */
34999
35034
 
35000
35035
  <h4 class="subsection">6.615.5 Since</h4>
35001
35036
 
35002
- <p>2.0.0 (planned)
35037
+ <p>1.4.0
35003
35038
 
35004
35039
  <div class="node">
35005
35040
  <a name="W0744"></a>
@@ -37590,13 +37625,18 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
37590
37625
 
37591
37626
  <h4 class="subsection">6.669.2 Content</h4>
37592
37627
 
37593
- <p><b>This message will be supported in AdLint 2.0.0</b>
37594
-
37595
- <p>Under construction.
37628
+ <p>Under construction.
37596
37629
 
37597
37630
  <h4 class="subsection">6.669.3 Sample code</h4>
37598
37631
 
37599
- <pre class="verbatim">struct ST { /* W0801 */
37632
+ <pre class="verbatim">struct foo { /* W0801 */
37633
+ };
37634
+
37635
+ struct bar { /* W0801 */
37636
+ int;
37637
+ int :1;
37638
+ long;
37639
+ double;
37600
37640
  };
37601
37641
  </pre>
37602
37642
 
@@ -37606,7 +37646,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
37606
37646
 
37607
37647
  <h4 class="subsection">6.669.5 Since</h4>
37608
37648
 
37609
- <p>2.0.0 (planned)
37649
+ <p>1.4.0
37610
37650
 
37611
37651
  <div class="node">
37612
37652
  <a name="W0802"></a>
@@ -37777,13 +37817,11 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
37777
37817
 
37778
37818
  <h4 class="subsection">6.674.2 Content</h4>
37779
37819
 
37780
- <p><b>This message will be supported in AdLint 2.0.0</b>
37781
-
37782
- <p>Under construction.
37820
+ <p>Under construction.
37783
37821
 
37784
37822
  <h4 class="subsection">6.674.3 Sample code</h4>
37785
37823
 
37786
- <pre class="verbatim">/* will be added */
37824
+ <pre class="verbatim">#define defined !defined /* W0806 */
37787
37825
  </pre>
37788
37826
 
37789
37827
  <h4 class="subsection">6.674.4 Related message</h4>
@@ -37795,7 +37833,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
37795
37833
 
37796
37834
  <h4 class="subsection">6.674.5 Since</h4>
37797
37835
 
37798
- <p>2.0.0 (planned)
37836
+ <p>1.4.0
37799
37837
 
37800
37838
  <div class="node">
37801
37839
  <a name="W0807"></a>
@@ -38248,7 +38286,9 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
38248
38286
 
38249
38287
  <h4 class="subsection">6.686.2 Content</h4>
38250
38288
 
38251
- <p>Under construction.
38289
+ <p><b>This message will be supported in AdLint 2.0.0</b>
38290
+
38291
+ <p>Under construction.
38252
38292
 
38253
38293
  <h4 class="subsection">6.686.3 Sample code</h4>
38254
38294
 
@@ -38263,7 +38303,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
38263
38303
 
38264
38304
  <h4 class="subsection">6.686.5 Since</h4>
38265
38305
 
38266
- <p>1.0.0
38306
+ <p>2.0.0 (planned)
38267
38307
 
38268
38308
  <div class="node">
38269
38309
  <a name="W0835"></a>
@@ -38734,13 +38774,24 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
38734
38774
 
38735
38775
  <h4 class="subsection">6.699.2 Content</h4>
38736
38776
 
38737
- <p><b>This message will be supported in AdLint 2.0.0</b>
38738
-
38739
- <p>Under construction.
38777
+ <p>Under construction.
38740
38778
 
38741
38779
  <h4 class="subsection">6.699.3 Sample code</h4>
38742
38780
 
38743
- <pre class="verbatim">/* will be added */
38781
+ <pre class="verbatim">extern const int func1(int); /* W1033 */
38782
+
38783
+ const int func2(int i) /* W1033 */
38784
+ {
38785
+ return i + 1;
38786
+ }
38787
+
38788
+ const int *func3(int i) /* OK */
38789
+ {
38790
+ static int j;
38791
+
38792
+ j = i;
38793
+ return &amp;j;
38794
+ }
38744
38795
  </pre>
38745
38796
 
38746
38797
  <h4 class="subsection">6.699.4 Related message</h4>
@@ -38749,7 +38800,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
38749
38800
 
38750
38801
  <h4 class="subsection">6.699.5 Since</h4>
38751
38802
 
38752
- <p>2.0.0 (planned)
38803
+ <p>1.4.0
38753
38804
 
38754
38805
  <div class="node">
38755
38806
  <a name="W1034"></a>
@@ -40033,13 +40084,24 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
40033
40084
 
40034
40085
  <h4 class="subsection">6.729.2 Content</h4>
40035
40086
 
40036
- <p><b>This message will be supported in AdLint 2.0.0</b>
40037
-
40038
- <p>Under construction.
40087
+ <p>Under construction.
40039
40088
 
40040
40089
  <h4 class="subsection">6.729.3 Sample code</h4>
40041
40090
 
40042
- <p>Under construction.
40091
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
40092
+
40093
+ int func(enum Color c)
40094
+ {
40095
+ switch (c) {
40096
+ case RED: /* OK */
40097
+ return 1;
40098
+ case 1: /* W1064 */
40099
+ return 2;
40100
+ }
40101
+
40102
+ return 0;
40103
+ }
40104
+ </pre>
40043
40105
 
40044
40106
  <h4 class="subsection">6.729.4 Related message</h4>
40045
40107
 
@@ -40060,7 +40122,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
40060
40122
 
40061
40123
  <h4 class="subsection">6.729.5 Since</h4>
40062
40124
 
40063
- <p>2.0.0 (planned)
40125
+ <p>1.4.0
40064
40126
 
40065
40127
  <div class="node">
40066
40128
  <a name="W1065"></a>
@@ -40081,13 +40143,24 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
40081
40143
 
40082
40144
  <h4 class="subsection">6.730.2 Content</h4>
40083
40145
 
40084
- <p><b>This message will be supported in AdLint 2.0.0</b>
40085
-
40086
- <p>Under construction.
40146
+ <p>Under construction.
40087
40147
 
40088
40148
  <h4 class="subsection">6.730.3 Sample code</h4>
40089
40149
 
40090
- <pre class="verbatim">/* will be added */
40150
+ <pre class="verbatim">enum Color { RED, BLUE, GREEN };
40151
+ enum Fruits { APPLE, BANANA, ORANGE, GRAPE };
40152
+
40153
+ int func(enum Color c)
40154
+ {
40155
+ switch (c) {
40156
+ case RED: /* OK */
40157
+ return 1;
40158
+ case ORANGE: /* W1065 */
40159
+ return 2;
40160
+ }
40161
+
40162
+ return 0;
40163
+ }
40091
40164
  </pre>
40092
40165
 
40093
40166
  <h4 class="subsection">6.730.4 Related message</h4>
@@ -40109,7 +40182,7 @@ Up:&nbsp;<a rel="up" accesskey="u" href="#Messages">Messages</a>
40109
40182
 
40110
40183
  <h4 class="subsection">6.730.5 Since</h4>
40111
40184
 
40112
- <p>2.0.0 (planned)
40185
+ <p>1.4.0
40113
40186
 
40114
40187
  <div class="node">
40115
40188
  <a name="W9001"></a>