回答編集履歴

1

ソース追記

2019/04/26 10:35

投稿

cateye
cateye

スコア6851

test CHANGED
@@ -3,3 +3,63 @@
3
3
  [構造体パッキング](http://tool-support.renesas.com/autoupdate/support/onlinehelp/ja-JP/csp/V4.01.00/CS+.chm/Compiler-CCRH.chm/Output/ccrh04c0204y0800.html)
4
4
 
5
5
  [前へならえ](http://www7b.biglobe.ne.jp/~robe/cpphtml/html03/cpp03014.html)
6
+
7
+ //
8
+
9
+ ```c
10
+
11
+ struct abc {
12
+
13
+ int A;
14
+
15
+ int B;
16
+
17
+ int C;
18
+
19
+ char D;
20
+
21
+ };
22
+
23
+ //
24
+
25
+ int main(void)
26
+
27
+ {
28
+
29
+ struct abc val;
30
+
31
+
32
+
33
+ return 0;
34
+
35
+ }
36
+
37
+
38
+
39
+ ```
40
+
41
+ 上記コードで、以下のワーニングがでます。VCはわからないのですがエラーの設定で最強のエラーチェックにすれば出るのではないかと?
42
+
43
+ ```text
44
+
45
+ usr ~/Project/test % clang -Weverything st.c
46
+
47
+ st.c:10:16: warning: unused variable 'val' [-Wunused-variable]
48
+
49
+ struct abc val;
50
+
51
+ ^
52
+
53
+ st.c:1:8: warning: padding size of 'struct abc' with 3 bytes to alignment boundary [-Wpadded]
54
+
55
+ struct abc {
56
+
57
+ ^
58
+
59
+ 2 warnings generated.
60
+
61
+ usr ~/Project/test %
62
+
63
+
64
+
65
+ ```