-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclang-tidy_14.0.txt
1251 lines (1247 loc) · 74.4 KB
/
clang-tidy_14.0.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
$ clang-tidy --version
Ubuntu LLVM version 14.0.0
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: cascadelake
$ cmake .
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is Clang 14.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mf/Repos/CWTS
$ make -k
[ 1%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_1.cpp.o
extern void array_bounds_1(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
void array_bounds_1(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:7:2: warning: array index 3 is past the end of the array (which contains 3 elements) [clang-diagnostic-array-bounds]
numbers[3] = 3; // ⚠️ array index out of bounds
^ ~
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:7:2: warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
numbers[3] = 3; // ⚠️ array index out of bounds
^ ~
/home/mf/Repos/CWTS/tests/array_bounds_1.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 2%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_2.cpp.o
extern int array_bounds_2(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
int array_bounds_2(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:7:9: warning: array index 3 is past the end of the array (which contains 3 elements) [clang-diagnostic-array-bounds]
return numbers[3]; // ⚠️ array index out of bounds
^ ~
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:7:9: warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
return numbers[3]; // ⚠️ array index out of bounds
^ ~
/home/mf/Repos/CWTS/tests/array_bounds_2.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 4%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_3.cpp.o
extern int array_bounds_3(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
int array_bounds_3(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:8:9: warning: array index 3 is past the end of the array (which contains 3 elements) [clang-diagnostic-array-bounds]
return numbers[index]; // ⚠️ array index out of bounds
^ ~~~~~
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:8:9: warning: array index 3 is past the end of the array (which contains 3 elements) [-Warray-bounds]
return numbers[index]; // ⚠️ array index out of bounds
^ ~~~~~
/home/mf/Repos/CWTS/tests/array_bounds_3.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 5%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_4.cpp.o
extern void array_bounds_4(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
void array_bounds_4(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:7:2: warning: array index -1 is before the beginning of the array [clang-diagnostic-array-bounds]
numbers[-1] = -1; // ⚠️ array index out of bounds
^ ~~
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:7:2: warning: array index -1 is before the beginning of the array [-Warray-bounds]
numbers[-1] = -1; // ⚠️ array index out of bounds
^ ~~
/home/mf/Repos/CWTS/tests/array_bounds_4.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 7%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_5.cpp.o
extern int array_bounds_5(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
int array_bounds_5(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:7:9: warning: array index -1 is before the beginning of the array [clang-diagnostic-array-bounds]
return numbers[-1]; // ⚠️ array index out of bounds
^ ~~
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:7:9: warning: array index -1 is before the beginning of the array [-Warray-bounds]
return numbers[-1]; // ⚠️ array index out of bounds
^ ~~
/home/mf/Repos/CWTS/tests/array_bounds_5.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 8%] Building CXX object CMakeFiles/CWTS.dir/tests/array_bounds_6.cpp.o
extern int array_bounds_6(void);
^
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:3:8: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:3:12: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int numbers[3] = { 0, 1, 2 };
^
int array_bounds_6(void)
^
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:8:9: warning: array index -1 is before the beginning of the array [clang-diagnostic-array-bounds]
return numbers[index]; // ⚠️ array index out of bounds
^ ~~~~~
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:8:9: warning: array index -1 is before the beginning of the array [-Warray-bounds]
return numbers[index]; // ⚠️ array index out of bounds
^ ~~~~~
/home/mf/Repos/CWTS/tests/array_bounds_6.cpp:3:1: note: array 'numbers' declared here
static int numbers[3] = { 0, 1, 2 };
^
1 warning generated.
[ 10%] Building CXX object CMakeFiles/CWTS.dir/tests/array_braces_missing.cpp.o
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:1: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:5: warning: variable 'numbers' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:23: warning: suggest braces around initialization of subobject [clang-diagnostic-missing-braces]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^~~~
{ }
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:29: warning: suggest braces around initialization of subobject [clang-diagnostic-missing-braces]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^~~~
{ }
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:23: warning: suggest braces around initialization of subobject [-Wmissing-braces]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^~~~
{ }
/home/mf/Repos/CWTS/tests/array_braces_missing.cpp:1:29: warning: suggest braces around initialization of subobject [-Wmissing-braces]
int numbers[2][2] = { 0, 1, 2, 3 }; // ⚠️ array braces are missing
^~~~
{ }
2 warnings generated.
[ 11%] Building CXX object CMakeFiles/CWTS.dir/tests/assignment_in_condition_1.cpp.o
extern bool assignment_in_condition_1(int alpha);
^
bool assignment_in_condition_1(int alpha)
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:6: warning: Although the value stored to 'alpha' is used in the enclosing expression, the value is never actually read from 'alpha' [clang-analyzer-deadcode.DeadStores]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^ ~
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:6: note: Although the value stored to 'alpha' is used in the enclosing expression, the value is never actually read from 'alpha'
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^ ~
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:6: warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
!= 0
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: warning: using the result of an assignment as a condition without parentheses [clang-diagnostic-parentheses]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
~~~~~~^~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: note: place parentheses around the assignment to silence this warning
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
( )
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: note: use '==' to turn this assignment into an equality comparison
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
==
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:14: warning: 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:16: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
{
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:6:10: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
return true;
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
~~~~~~^~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: note: place parentheses around the assignment to silence this warning
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
( )
/home/mf/Repos/CWTS/tests/assignment_in_condition_1.cpp:5:12: note: use '==' to turn this assignment into an equality comparison
if (alpha = 5) // ⚠️ 'alpha = 5' will evaluate to value 5, which is always true
^
==
1 warning generated.
[ 13%] Building CXX object CMakeFiles/CWTS.dir/tests/assignment_in_condition_2.cpp.o
extern bool assignment_in_condition_2(int alpha);
^
bool assignment_in_condition_2(int alpha)
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:6: warning: Although the value stored to 'alpha' is used in the enclosing expression, the value is never actually read from 'alpha' [clang-analyzer-deadcode.DeadStores]
if (alpha =! 5) // ⚠️ I meant '!='
^ ~~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:6: note: Although the value stored to 'alpha' is used in the enclosing expression, the value is never actually read from 'alpha'
if (alpha =! 5) // ⚠️ I meant '!='
^ ~~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:6: warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
if (alpha =! 5) // ⚠️ I meant '!='
^
!= 0
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: warning: using the result of an assignment as a condition without parentheses [clang-diagnostic-parentheses]
if (alpha =! 5) // ⚠️ I meant '!='
~~~~~~^~~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: note: place parentheses around the assignment to silence this warning
if (alpha =! 5) // ⚠️ I meant '!='
^
( )
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: note: use '==' to turn this assignment into an equality comparison
if (alpha =! 5) // ⚠️ I meant '!='
^
==
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:13: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
if (alpha =! 5) // ⚠️ I meant '!='
^
static_cast<int>( )
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:15: warning: 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
if (alpha =! 5) // ⚠️ I meant '!='
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:15: warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
if (alpha =! 5) // ⚠️ I meant '!='
^
true
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:17: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (alpha =! 5) // ⚠️ I meant '!='
^
{
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:6:10: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
return true;
^
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
if (alpha =! 5) // ⚠️ I meant '!='
~~~~~~^~~~
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: note: place parentheses around the assignment to silence this warning
if (alpha =! 5) // ⚠️ I meant '!='
^
( )
/home/mf/Repos/CWTS/tests/assignment_in_condition_2.cpp:5:12: note: use '==' to turn this assignment into an equality comparison
if (alpha =! 5) // ⚠️ I meant '!='
^
==
1 warning generated.
[ 14%] Building CXX object CMakeFiles/CWTS.dir/tests/bool_compare.cpp.o
extern bool bool_compare(int alpha);
^
bool bool_compare(int alpha)
^
/home/mf/Repos/CWTS/tests/bool_compare.cpp:5:9: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
return (alpha > 0) == 2; // ⚠️ condition is always false
^
static_cast<int>
/home/mf/Repos/CWTS/tests/bool_compare.cpp:5:21: warning: result of comparison of constant 2 with expression of type 'bool' is always false [clang-diagnostic-tautological-constant-out-of-range-compare]
return (alpha > 0) == 2; // ⚠️ condition is always false
~~~~~~~~~~~ ^ ~
/home/mf/Repos/CWTS/tests/bool_compare.cpp:5:21: warning: result of comparison of constant 2 with expression of type 'bool' is always false [-Wtautological-constant-out-of-range-compare]
return (alpha > 0) == 2; // ⚠️ condition is always false
~~~~~~~~~~~ ^ ~
1 warning generated.
[ 15%] Building CXX object CMakeFiles/CWTS.dir/tests/branches_identical_1.cpp.o
extern bool branches_identical_1(int alpha);
^
bool branches_identical_1(int alpha)
^
/home/mf/Repos/CWTS/tests/branches_identical_1.cpp:5:2: warning: if with identical then and else branches [bugprone-branch-clone]
if (alpha == 0)
^
/home/mf/Repos/CWTS/tests/branches_identical_1.cpp:7:2: note: else branch starts here
else
^
/home/mf/Repos/CWTS/tests/branches_identical_1.cpp:5:17: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (alpha == 0)
^
{
/home/mf/Repos/CWTS/tests/branches_identical_1.cpp:7:2: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
else
^~~~
return false
/home/mf/Repos/CWTS/tests/branches_identical_1.cpp:7:6: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
else
^
note: this fix will not be applied because it overlaps with another fix
[ 17%] Building CXX object CMakeFiles/CWTS.dir/tests/branches_identical_2.cpp.o
extern int branches_identical_2(int alpha);
^
int branches_identical_2(int alpha)
^
/home/mf/Repos/CWTS/tests/branches_identical_2.cpp:5:22: warning: conditional operator with identical true and false expressions [bugprone-branch-clone]
return (alpha == 0) ? 0 : 0; // ⚠️ both branches are identical
^
/home/mf/Repos/CWTS/tests/branches_identical_2.cpp:5:26: warning: 'true' and 'false' expressions are equivalent [misc-redundant-expression]
return (alpha == 0) ? 0 : 0; // ⚠️ both branches are identical
^
[ 18%] Building CXX object CMakeFiles/CWTS.dir/tests/branches_identical_3.cpp.o
extern int branches_identical_3(bool alpha);
^
int branches_identical_3(bool alpha)
^
/home/mf/Repos/CWTS/tests/branches_identical_3.cpp:5:15: warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
if (alpha == true)
~~~~~~~~~^~~~
alpha
/home/mf/Repos/CWTS/tests/branches_identical_3.cpp:5:20: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (alpha == true)
^
{
/home/mf/Repos/CWTS/tests/branches_identical_3.cpp:7:2: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
else if (alpha == true) // ⚠️ this condition is obsolete
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/branches_identical_3.cpp:7:20: warning: redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
else if (alpha == true) // ⚠️ this condition is obsolete
^
note: this fix will not be applied because it overlaps with another fix
/home/mf/Repos/CWTS/tests/branches_identical_3.cpp:7:25: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
else if (alpha == true) // ⚠️ this condition is obsolete
^
note: this fix will not be applied because it overlaps with another fix
[ 20%] Building CXX object CMakeFiles/CWTS.dir/tests/cast_unnecessary.cpp.o
extern int *cast_unnecessary(int *ptr);
^
int *cast_unnecessary(int *ptr)
^
[ 21%] Building CXX object CMakeFiles/CWTS.dir/tests/code_unreachable_1.cpp.o
extern void code_unreachable_1(int alpha);
^
void code_unreachable_1(int alpha)
^
int main() { return 0; } // to make the linker happy
^
[ 23%] Building CXX object CMakeFiles/CWTS.dir/tests/code_unreachable_2.cpp.o
extern void code_unreachable_2(int alpha);
^
void code_unreachable_2(int alpha)
^
/home/mf/Repos/CWTS/tests/code_unreachable_2.cpp:5:8: warning: throwing an exception whose type 'int' is not derived from 'std::exception' [hicpp-exception-baseclass]
throw 0;
~~~~~~^
[ 24%] Building CXX object CMakeFiles/CWTS.dir/tests/code_unreachable_3.cpp.o
extern int code_unreachable_3(int alpha);
^
int code_unreachable_3(int alpha)
^
/home/mf/Repos/CWTS/tests/code_unreachable_3.cpp:5:17: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (alpha == 0)
^
{
/home/mf/Repos/CWTS/tests/code_unreachable_3.cpp:7:2: warning: do not use 'else' after 'return' [llvm-else-after-return,readability-else-after-return]
else
^~~~
return 1
/home/mf/Repos/CWTS/tests/code_unreachable_3.cpp:7:6: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
else
^
note: this fix will not be applied because it overlaps with another fix
[ 26%] Building CXX object CMakeFiles/CWTS.dir/tests/comment.cpp.o
/home/mf/Repos/CWTS/tests/comment.cpp:1:4: warning: '/*' within block comment [clang-diagnostic-comment]
/* /* ⚠️ comment in comment */
^
/home/mf/Repos/CWTS/tests/comment.cpp:1:4: warning: '/*' within block comment [-Wcomment]
/* /* ⚠️ comment in comment */
^
1 warning generated.
[ 27%] Building CXX object CMakeFiles/CWTS.dir/tests/constant_expression.cpp.o
extern void constant_expression(void);
^
void constant_expression(void)
^
/home/mf/Repos/CWTS/tests/constant_expression.cpp:5:2: warning: kernel performance could be improved by unrolling this loop with a '#pragma unroll' directive [altera-unroll-loops]
for (unsigned int i = 10; i >= 0; i++) // ⚠️ condition is always true
^
/home/mf/Repos/CWTS/tests/constant_expression.cpp:5:24: warning: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
for (unsigned int i = 10; i >= 0; i++) // ⚠️ condition is always true
^
/home/mf/Repos/CWTS/tests/constant_expression.cpp:5:40: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
for (unsigned int i = 10; i >= 0; i++) // ⚠️ condition is always true
^
{
[ 28%] Building CXX object CMakeFiles/CWTS.dir/tests/constant_overflow.cpp.o
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:1: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
^
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:6: warning: variable 'letters' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
^
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:26: warning: narrowing conversion from constant value 65535 (0x0000FFFF) of type 'int' to signed type 'char' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
^
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:26: error: constant expression evaluates to 65535 which cannot be narrowed to type 'char' [clang-diagnostic-c++11-narrowing]
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
^~~~~~
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:26: note: insert an explicit cast to silence this issue
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
^~~~~~
static_cast<char>( )
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:26: warning: implicit conversion from 'int' to 'char' changes value from 65535 to -1 [clang-diagnostic-constant-conversion]
char letters[] = { 1, 2, 0xFFFF }; // ⚠️ 0xffff is too big for 'char'
~ ^~~~~~
/home/mf/Repos/CWTS/tests/constant_overflow.cpp:1:26: warning: 0xFFFF is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
11 warnings and 1 error generated.
Error while processing /home/mf/Repos/CWTS/tests/constant_overflow.cpp.
Found compiler error(s).
make[2]: *** [CMakeFiles/CWTS.dir/build.make:342: CMakeFiles/CWTS.dir/tests/constant_overflow.cpp.o] Error 1
[ 30%] Building CXX object CMakeFiles/CWTS.dir/tests/division_by_zero_1.cpp.o
extern int division_by_zero_1(int alpha);
^
int division_by_zero_1(int alpha)
^
/home/mf/Repos/CWTS/tests/division_by_zero_1.cpp:5:15: warning: Division by zero [clang-analyzer-core.DivideZero]
return alpha / 0; // ⚠️ division by zero
~~~~~~^~~
/home/mf/Repos/CWTS/tests/division_by_zero_1.cpp:5:15: note: Division by zero
return alpha / 0; // ⚠️ division by zero
~~~~~~^~~
/home/mf/Repos/CWTS/tests/division_by_zero_1.cpp:5:15: warning: division by zero is undefined [clang-diagnostic-division-by-zero]
return alpha / 0; // ⚠️ division by zero
^ ~
/home/mf/Repos/CWTS/tests/division_by_zero_1.cpp:5:15: warning: division by zero is undefined [-Wdivision-by-zero]
return alpha / 0; // ⚠️ division by zero
^ ~
1 warning generated.
[ 31%] Building CXX object CMakeFiles/CWTS.dir/tests/division_by_zero_2.cpp.o
extern float division_by_zero_2(float alpha);
^
float division_by_zero_2(float alpha)
^
/home/mf/Repos/CWTS/tests/division_by_zero_2.cpp:5:9: warning: narrowing conversion from 'double' to 'float' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
return alpha / 0.0; // ⚠️ division by zero
^
[ 33%] Building CXX object CMakeFiles/CWTS.dir/tests/enum_unhandled.cpp.o
typedef enum { red, green, blue } Color;
^
typedef enum { red, green, blue } Color;
^
extern int enum_unhandled(Color color);
^
int enum_unhandled(Color color)
^
[ 34%] Building CXX object CMakeFiles/CWTS.dir/tests/enum_value.cpp.o
typedef enum { red = 0, green = 1, blue = 0 } Color; // ⚠️ 'red' and 'blue' have the same value
^
typedef enum { red = 0, green = 1, blue = 0 } Color; // ⚠️ 'red' and 'blue' have the same value
^
[ 36%] Building CXX object CMakeFiles/CWTS.dir/tests/extra_tokens.cpp.o
/home/mf/Repos/CWTS/tests/extra_tokens.cpp:2:8: warning: extra tokens at end of #endif directive [clang-diagnostic-extra-tokens]
#endif BAD // ⚠️ #endif has no parameters
^
//
/home/mf/Repos/CWTS/tests/extra_tokens.cpp:2:8: warning: extra tokens at end of #endif directive [-Wextra-tokens]
#endif BAD // ⚠️ #endif has no parameters
^
//
1 warning generated.
[ 37%] Building CXX object CMakeFiles/CWTS.dir/tests/file_empty.cpp.o
[ 39%] Building CXX object CMakeFiles/CWTS.dir/tests/format_string_1.cpp.o
/home/mf/Repos/CWTS/tests/format_string_1.cpp:1:1: warning: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers]
#include <stdio.h>
^~~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/format_string_1.cpp:1:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [hicpp-deprecated-headers]
#include <stdio.h>
^
note: this fix will not be applied because it overlaps with another fix
extern void format_string_1();
^
void format_string_1()
^
/home/mf/Repos/CWTS/tests/format_string_1.cpp:7:15: warning: format specifies type 'char *' but the argument has type 'int' [clang-diagnostic-format]
printf("%s", 0); // ⚠️ zero pointer access
~~ ^
%d
/home/mf/Repos/CWTS/tests/format_string_1.cpp:7:15: warning: format specifies type 'char *' but the argument has type 'int' [-Wformat]
printf("%s", 0); // ⚠️ zero pointer access
~~ ^
%d
1 warning generated.
[ 40%] Building CXX object CMakeFiles/CWTS.dir/tests/format_string_2.cpp.o
/home/mf/Repos/CWTS/tests/format_string_2.cpp:1:1: warning: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers]
#include <stdio.h>
^~~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/format_string_2.cpp:1:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [hicpp-deprecated-headers]
#include <stdio.h>
^
note: this fix will not be applied because it overlaps with another fix
extern void format_string_2(void);
^
void format_string_2(void)
^
/home/mf/Repos/CWTS/tests/format_string_2.cpp:7:2: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
printf(""); // ⚠️ empty format string
^
[ 42%] Building CXX object CMakeFiles/CWTS.dir/tests/format_string_3.cpp.o
/home/mf/Repos/CWTS/tests/format_string_3.cpp:1:1: warning: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers]
#include <stdio.h>
^~~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/format_string_3.cpp:1:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [hicpp-deprecated-headers]
#include <stdio.h>
^
note: this fix will not be applied because it overlaps with another fix
extern void format_string_3(char *str);
^
void format_string_3(char *str)
^
/home/mf/Repos/CWTS/tests/format_string_3.cpp:7:2: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
printf(str); // ⚠️ <str> is handled as format string
^
/home/mf/Repos/CWTS/tests/format_string_3.cpp:7:9: warning: format string is not a string literal (potentially insecure) [clang-diagnostic-format-security]
printf(str); // ⚠️ <str> is handled as format string
^~~
/home/mf/Repos/CWTS/tests/format_string_3.cpp:7:9: note: treat the string as an argument to avoid this
printf(str); // ⚠️ <str> is handled as format string
^
"%s",
/home/mf/Repos/CWTS/tests/format_string_3.cpp:7:9: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
printf(str); // ⚠️ <str> is handled as format string
^~~
/home/mf/Repos/CWTS/tests/format_string_3.cpp:7:9: note: treat the string as an argument to avoid this
printf(str); // ⚠️ <str> is handled as format string
^
"%s",
1 warning generated.
[ 43%] Building CXX object CMakeFiles/CWTS.dir/tests/function_parameter_unused.cpp.o
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:1:1: warning: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers]
#include <stdio.h>
^~~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:1:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead [hicpp-deprecated-headers]
#include <stdio.h>
^
note: this fix will not be applied because it overlaps with another fix
extern void parameter_unused(int alpha);
^
void parameter_unused(int alpha) // ⚠️ function parameter is unused
^
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:5:27: warning: unused parameter 'alpha' [clang-diagnostic-unused-parameter]
void parameter_unused(int alpha) // ⚠️ function parameter is unused
^
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:5:27: warning: parameter 'alpha' is unused [misc-unused-parameters]
void parameter_unused(int alpha) // ⚠️ function parameter is unused
^~~~~
/*alpha*/
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:7:2: warning: do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg,hicpp-vararg]
printf(" ");
^
/home/mf/Repos/CWTS/tests/function_parameter_unused.cpp:5:27: warning: unused parameter 'alpha' [-Wunused-parameter]
void parameter_unused(int alpha) // ⚠️ function parameter is unused
^
1 warning generated.
[ 44%] Building CXX object CMakeFiles/CWTS.dir/tests/function_without_prototype.cpp.o
void function_without_prototype() // ⚠️ function without prototype
^
[ 46%] Building CXX object CMakeFiles/CWTS.dir/tests/function_without_return_value.cpp.o
extern int function_without_return_value(void);
^
int function_without_return_value(void)
^
/home/mf/Repos/CWTS/tests/function_without_return_value.cpp:5:2: error: non-void function 'function_without_return_value' should return a value [clang-diagnostic-return-type]
return; // ⚠️ return value is missing
^
2 warnings and 1 error generated.
Error while processing /home/mf/Repos/CWTS/tests/function_without_return_value.cpp.
Found compiler error(s).
make[2]: *** [CMakeFiles/CWTS.dir/build.make:510: CMakeFiles/CWTS.dir/tests/function_without_return_value.cpp.o] Error 1
[ 47%] Building CXX object CMakeFiles/CWTS.dir/tests/identifier_undefined.cpp.o
/home/mf/Repos/CWTS/tests/identifier_undefined.cpp:1:5: warning: 'IDENTIFIER_UNDEFINED' is not defined, evaluates to 0 [clang-diagnostic-undef]
#if IDENTIFIER_UNDEFINED // ⚠️ identifier is undefined
^
/home/mf/Repos/CWTS/tests/identifier_undefined.cpp:1:5: warning: 'IDENTIFIER_UNDEFINED' is not defined, evaluates to 0 [-Wundef]
#if IDENTIFIER_UNDEFINED // ⚠️ identifier is undefined
^
1 warning generated.
[ 49%] Building CXX object CMakeFiles/CWTS.dir/tests/implicit_conversion_1.cpp.o
extern char implicit_conversion_1(short alpha);
^
/home/mf/Repos/CWTS/tests/implicit_conversion_1.cpp:1:35: warning: consider replacing 'short' with 'int16' [google-runtime-int]
extern char implicit_conversion_1(short alpha);
^
char implicit_conversion_1(short alpha)
^
/home/mf/Repos/CWTS/tests/implicit_conversion_1.cpp:3:28: warning: consider replacing 'short' with 'int16' [google-runtime-int]
char implicit_conversion_1(short alpha)
^
/home/mf/Repos/CWTS/tests/implicit_conversion_1.cpp:5:9: warning: narrowing conversion from 'short' to signed type 'char' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
return alpha; // ⚠️ implicit conversion
^
[ 50%] Building CXX object CMakeFiles/CWTS.dir/tests/implicit_conversion_2.cpp.o
/home/mf/Repos/CWTS/tests/implicit_conversion_2.cpp:1:8: warning: consider replacing 'short' with 'int16' [google-runtime-int]
extern short implicit_conversion_2(int alpha);
^
extern short implicit_conversion_2(int alpha);
^
/home/mf/Repos/CWTS/tests/implicit_conversion_2.cpp:3:1: warning: consider replacing 'short' with 'int16' [google-runtime-int]
short implicit_conversion_2(int alpha)
^
short implicit_conversion_2(int alpha)
^
/home/mf/Repos/CWTS/tests/implicit_conversion_2.cpp:5:9: warning: narrowing conversion from 'int' to signed type 'short' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
return alpha; // ⚠️ implicit conversion
^
[ 52%] Building CXX object CMakeFiles/CWTS.dir/tests/implicit_conversion_3.cpp.o
extern int implicit_conversion_3(long alpha);
^
/home/mf/Repos/CWTS/tests/implicit_conversion_3.cpp:1:34: warning: consider replacing 'long' with 'int64' [google-runtime-int]
extern int implicit_conversion_3(long alpha);
^
int implicit_conversion_3(long alpha)
^
/home/mf/Repos/CWTS/tests/implicit_conversion_3.cpp:3:27: warning: consider replacing 'long' with 'int64' [google-runtime-int]
int implicit_conversion_3(long alpha)
^
/home/mf/Repos/CWTS/tests/implicit_conversion_3.cpp:5:9: warning: narrowing conversion from 'long' to signed type 'int' is implementation-defined [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
return alpha; // ⚠️ implicit conversion
^
[ 53%] Building CXX object CMakeFiles/CWTS.dir/tests/label_unused.cpp.o
extern int label_unused(int alpha);
^
int label_unused(int alpha)
^
/home/mf/Repos/CWTS/tests/label_unused.cpp:5:1: warning: unused label 'label_is_unused' [clang-diagnostic-unused-label]
label_is_unused: // ⚠️ label is unused
^~~~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/label_unused.cpp:5:1: warning: unused label 'label_is_unused' [-Wunused-label]
label_is_unused: // ⚠️ label is unused
^~~~~~~~~~~~~~~~~
1 warning generated.
[ 55%] Building CXX object CMakeFiles/CWTS.dir/tests/logical_not.cpp.o
extern int logical_not(int alpha);
^
int logical_not(int alpha)
^
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:2: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^~~~~
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:11: warning: implicit conversion bool -> 'int' [readability-implicit-bool-conversion]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^
static_cast<int>( )
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:12: warning: implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
~^
== 0
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:13: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:15: warning: converting the result of '<<' to a boolean always evaluates to true [clang-diagnostic-tautological-constant-compare]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:18: warning: 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^
/home/mf/Repos/CWTS/tests/logical_not.cpp:5:15: warning: converting the result of '<<' to a boolean always evaluates to true [-Wtautological-constant-compare]
alpha &= !(1 << 7); // ⚠️ I meant '~' instead of '!'
^
1 warning generated.
[ 56%] Building CXX object CMakeFiles/CWTS.dir/tests/member_init_reorder.cpp.o
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:1:8: warning: accessing fields in struct 'Alpha' is inefficient due to poor alignment; currently aligned to 4 bytes, but recommended alignment is 8 bytes [altera-struct-pack-align]
struct Alpha {
^
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:1:8: note: use "__attribute__((aligned(8)))" to align struct 'Alpha' to 8 bytes
struct Alpha {
^
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:2:6: warning: member variable 'beta' has public visibility [misc-non-private-member-variables-in-classes]
int beta;
^
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:3:6: warning: member variable 'gamma' has public visibility [misc-non-private-member-variables-in-classes]
int gamma;
^
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:4:11: warning: field 'gamma' will be initialized after field 'beta' [clang-diagnostic-reorder-ctor]
Alpha(): gamma(0), beta(1) { } // ⚠️ member reordered
^~~~~~~~ ~~~~~~~
beta(1) gamma(0)
/home/mf/Repos/CWTS/tests/member_init_reorder.cpp:4:11: warning: field 'gamma' will be initialized after field 'beta' [-Wreorder-ctor]
Alpha(): gamma(0), beta(1) { } // ⚠️ member reordered
^~~~~~~~ ~~~~~~~
beta(1) gamma(0)
1 warning generated.
[ 57%] Building CXX object CMakeFiles/CWTS.dir/tests/null_pointer_access_1.cpp.o
extern void null_pointer_access_1(void);
^
void null_pointer_access_1(void)
^
/home/mf/Repos/CWTS/tests/null_pointer_access_1.cpp:5:14: warning: variable 'ptr' provides global access to a non-const object; consider making the pointed-to data 'const' [cppcoreguidelines-avoid-non-const-global-variables]
static int *ptr; // NULL by default
^
/home/mf/Repos/CWTS/tests/null_pointer_access_1.cpp:7:7: warning: Dereference of null pointer (loaded from variable 'ptr') [clang-analyzer-core.NullDereference]
*ptr = 0; // ⚠️ null pointer access
~~~ ^
/home/mf/Repos/CWTS/tests/null_pointer_access_1.cpp:5:2: note: 'ptr' initialized to a null pointer value
static int *ptr; // NULL by default
^~~~~~~~~~~~~~~
/home/mf/Repos/CWTS/tests/null_pointer_access_1.cpp:7:7: note: Dereference of null pointer (loaded from variable 'ptr')
*ptr = 0; // ⚠️ null pointer access
~~~ ^
[ 59%] Building CXX object CMakeFiles/CWTS.dir/tests/null_pointer_access_2.cpp.o
extern void null_pointer_access_2(int *ptr, int value);
^
void null_pointer_access_2(int *ptr, int value)
^
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:5:13: warning: use nullptr [hicpp-use-nullptr]
int *tmp = 0;
^
nullptr
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:6:28: warning: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
if (0 <= value && value < 10)
^
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:6:31: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (0 <= value && value < 10)
^
{
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:7:20: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
tmp = ptr + value;
^
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:8:7: warning: Dereference of null pointer (loaded from variable 'tmp') [clang-analyzer-core.NullDereference]
*tmp = 1; // ⚠️ q may be NULL
~~~ ^
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:5:2: note: 'tmp' initialized to a null pointer value
int *tmp = 0;
^~~~~~~~
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:6:6: note: Assuming 'value' is < 0
if (0 <= value && value < 10)
^~~~~~~~~~
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:6:17: note: Left side of '&&' is false
if (0 <= value && value < 10)
^
/home/mf/Repos/CWTS/tests/null_pointer_access_2.cpp:8:7: note: Dereference of null pointer (loaded from variable 'tmp')
*tmp = 1; // ⚠️ q may be NULL
~~~ ^
[ 60%] Building CXX object CMakeFiles/CWTS.dir/tests/parentheses.cpp.o
extern int parentheses(int value);
^
int parentheses(int value)
^
/home/mf/Repos/CWTS/tests/parentheses.cpp:5:16: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (value > 0) // ⚠️ explicit parentheses recommended
^
{
/home/mf/Repos/CWTS/tests/parentheses.cpp:6:16: warning: 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
if (value == 7)
^
/home/mf/Repos/CWTS/tests/parentheses.cpp:6:18: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
if (value == 7)
^
{
/home/mf/Repos/CWTS/tests/parentheses.cpp:8:2: warning: add explicit braces to avoid dangling else [clang-diagnostic-dangling-else]
else
^
/home/mf/Repos/CWTS/tests/parentheses.cpp:8:2: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
/home/mf/Repos/CWTS/tests/parentheses.cpp:8:6: warning: statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
else
^
{
/home/mf/Repos/CWTS/tests/parentheses.cpp:8:2: warning: add explicit braces to avoid dangling else [-Wdangling-else]
else
^
1 warning generated.
[ 62%] Building CXX object CMakeFiles/CWTS.dir/tests/pointer_compare.cpp.o
extern int pointer_compare(char *ptr);
^
int pointer_compare(char *ptr)
^
/home/mf/Repos/CWTS/tests/pointer_compare.cpp:3:27: warning: pointer parameter 'ptr' can be pointer to const [readability-non-const-parameter]
int pointer_compare(char *ptr)
^
const
/home/mf/Repos/CWTS/tests/pointer_compare.cpp:5:14: error: comparison between pointer and integer ('char *' and 'char') [clang-diagnostic-error]
return (ptr == '\0'); // ⚠️ I meant "*ptr"
~~~ ^ ~~~~
3 warnings and 1 error generated.
Error while processing /home/mf/Repos/CWTS/tests/pointer_compare.cpp.
Found compiler error(s).
make[2]: *** [CMakeFiles/CWTS.dir/build.make:664: CMakeFiles/CWTS.dir/tests/pointer_compare.cpp.o] Error 1
[ 63%] Building CXX object CMakeFiles/CWTS.dir/tests/recursive_include.cpp.o
/home/mf/Repos/CWTS/tests/recursive_include.cpp:1:10: error: #include nested too deeply [clang-diagnostic-error]
#include "recursive_include.cpp" // ⚠️ recursive #include
^
/home/mf/Repos/CWTS/tests/recursive_include.cpp:1:11: warning: suspicious #include of file with '.cpp' extension [bugprone-suspicious-include]
#include "recursive_include.cpp" // ⚠️ recursive #include
^
200 warnings and 1 error generated.
Error while processing /home/mf/Repos/CWTS/tests/recursive_include.cpp.
Suppressed 199 warnings (199 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).
make[2]: *** [CMakeFiles/CWTS.dir/build.make:678: CMakeFiles/CWTS.dir/tests/recursive_include.cpp.o] Error 1
[ 65%] Building CXX object CMakeFiles/CWTS.dir/tests/shift_count_negative.cpp.o
extern int shift_count_negative(int value);
^
int shift_count_negative(int value)
^
/home/mf/Repos/CWTS/tests/shift_count_negative.cpp:5:9: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
return value << -1; // ⚠️ shift count is negative
^~~~~
/home/mf/Repos/CWTS/tests/shift_count_negative.cpp:5:15: warning: shift count is negative [clang-diagnostic-shift-count-negative]
return value << -1; // ⚠️ shift count is negative
^ ~~
/home/mf/Repos/CWTS/tests/shift_count_negative.cpp:5:15: warning: shift count is negative [-Wshift-count-negative]
return value << -1; // ⚠️ shift count is negative
^ ~~
1 warning generated.
[ 66%] Building CXX object CMakeFiles/CWTS.dir/tests/shift_count_overflow.cpp.o
extern int shift_count_overflow(int value);
^
int shift_count_overflow(int value)
^
/home/mf/Repos/CWTS/tests/shift_count_overflow.cpp:5:9: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
return value << 66; // ⚠️ shift count is too high
^~~~~
/home/mf/Repos/CWTS/tests/shift_count_overflow.cpp:5:15: warning: shift count >= width of type [clang-diagnostic-shift-count-overflow]
return value << 66; // ⚠️ shift count is too high
^ ~~
/home/mf/Repos/CWTS/tests/shift_count_overflow.cpp:5:18: warning: 66 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
return value << 66; // ⚠️ shift count is too high
^
/home/mf/Repos/CWTS/tests/shift_count_overflow.cpp:5:15: warning: shift count >= width of type [-Wshift-count-overflow]
return value << 66; // ⚠️ shift count is too high
^ ~~
1 warning generated.
[ 68%] Building CXX object CMakeFiles/CWTS.dir/tests/shift_overflow.cpp.o
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:1:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead [hicpp-deprecated-headers]
#include <limits.h>
^~~~~~~~~~
<climits>
extern int shift_overflow(void);
^
int shift_overflow(void)
^
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:7:17: warning: The result of the left shift is undefined due to shifting '2147483647' by '10', which is unrepresentable in the unsigned version of the return type 'int' [clang-analyzer-core.UndefinedBinaryOperatorResult]
return INT_MAX << 10; // ⚠️ shift overflow
^
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:7:17: note: The result of the left shift is undefined due to shifting '2147483647' by '10', which is unrepresentable in the unsigned version of the return type 'int'
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:7:17: warning: signed shift result (0x1FFFFFFFC00) requires 42 bits to represent, but 'int' only has 32 bits [clang-diagnostic-shift-overflow]
return INT_MAX << 10; // ⚠️ shift overflow
^ ~~
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:7:20: warning: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
return INT_MAX << 10; // ⚠️ shift overflow
^
/home/mf/Repos/CWTS/tests/shift_overflow.cpp:7:17: warning: signed shift result (0x1FFFFFFFC00) requires 42 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
return INT_MAX << 10; // ⚠️ shift overflow
~~~~~~~ ^ ~~
1 warning generated.
[ 69%] Building CXX object CMakeFiles/CWTS.dir/tests/shift_value_negative.cpp.o
extern int shift_value_negative(void);
^
int shift_value_negative(void)
^
/home/mf/Repos/CWTS/tests/shift_value_negative.cpp:5:9: warning: use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
return -1 << 2; // ⚠️ value to shift is negative
^~
/home/mf/Repos/CWTS/tests/shift_value_negative.cpp:5:12: warning: The result of the left shift is undefined because the left operand is negative [clang-analyzer-core.UndefinedBinaryOperatorResult]
return -1 << 2; // ⚠️ value to shift is negative
~~ ^
/home/mf/Repos/CWTS/tests/shift_value_negative.cpp:5:12: note: The result of the left shift is undefined because the left operand is negative
return -1 << 2; // ⚠️ value to shift is negative
~~ ^
/home/mf/Repos/CWTS/tests/shift_value_negative.cpp:5:12: warning: shifting a negative signed value is undefined [clang-diagnostic-shift-negative-value]
return -1 << 2; // ⚠️ value to shift is negative
~~ ^
/home/mf/Repos/CWTS/tests/shift_value_negative.cpp:5:12: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
return -1 << 2; // ⚠️ value to shift is negative
~~ ^
1 warning generated.
[ 71%] Building CXX object CMakeFiles/CWTS.dir/tests/stack_address_returned.cpp.o
extern int *stack_address_returned(void);
^
int *stack_address_returned(void)
^
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:5:2: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays]
int array[10] = {};
^
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:5:12: warning: 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
int array[10] = {};
^
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:7:2: warning: Address of stack memory associated with local variable 'array' returned to caller [clang-analyzer-core.StackAddressEscape]
return array; // ⚠️ returns stack address
^ ~~~~~
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:7:2: note: Address of stack memory associated with local variable 'array' returned to caller
return array; // ⚠️ returns stack address
^ ~~~~~
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:7:9: warning: address of stack memory associated with local variable 'array' returned [clang-diagnostic-return-stack-address]
return array; // ⚠️ returns stack address
^~~~~
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:7:9: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
/home/mf/Repos/CWTS/tests/stack_address_returned.cpp:7:9: warning: address of stack memory associated with local variable 'array' returned [-Wreturn-stack-address]
return array; // ⚠️ returns stack address
^~~~~
1 warning generated.
[ 72%] Building CXX object CMakeFiles/CWTS.dir/tests/static_const_unused.cpp.o
/home/mf/Repos/CWTS/tests/static_const_unused.cpp:1:18: warning: unused variable 'static_const_unused' [clang-diagnostic-unused-const-variable]
static const int static_const_unused = 0; // ⚠️ static const is unused
^
/home/mf/Repos/CWTS/tests/static_const_unused.cpp:1:18: warning: unused variable 'static_const_unused' [-Wunused-const-variable]
static const int static_const_unused = 0; // ⚠️ static const is unused
^
1 warning generated.
[ 73%] Building CXX object CMakeFiles/CWTS.dir/tests/static_function_unused.cpp.o
/home/mf/Repos/CWTS/tests/static_function_unused.cpp:1:13: warning: unused function 'static_function_unused' [clang-diagnostic-unused-function]
static void static_function_unused(void) // ⚠️ static function is unused
^
/home/mf/Repos/CWTS/tests/static_function_unused.cpp:1:13: warning: unused function 'static_function_unused' [-Wunused-function]
static void static_function_unused(void) // ⚠️ static function is unused
^
1 warning generated.
[ 75%] Building CXX object CMakeFiles/CWTS.dir/tests/switch_body_empty.cpp.o
extern void switch_body_empty(int value);
^
void switch_body_empty(int value)
^
/home/mf/Repos/CWTS/tests/switch_body_empty.cpp:5:2: warning: switch statement without labels has no effect [hicpp-multiway-paths-covered]
switch (value) // ⚠️ the switch body is empty
^
[ 76%] Building CXX object CMakeFiles/CWTS.dir/tests/switch_code_unreachable.cpp.o
extern int switch_code_unreachable(int value);
^
int switch_code_unreachable(int value)
^
[ 78%] Building CXX object CMakeFiles/CWTS.dir/tests/switch_default_missing.cpp.o
bool switch_default_missing(int value);
^
bool switch_default_missing(int value)
^
/home/mf/Repos/CWTS/tests/switch_default_missing.cpp:5:2: warning: potential uncovered code path; add a default label [hicpp-multiway-paths-covered]
switch (value) // ⚠️ the switch default is missing
^
[ 79%] Building CXX object CMakeFiles/CWTS.dir/tests/value_unused_1.cpp.o
extern int value_unused_1(int alpha, int beta);
^
int value_unused_1(int alpha, int beta)
^
/home/mf/Repos/CWTS/tests/value_unused_1.cpp:5:8: warning: expression result unused [clang-diagnostic-unused-value]
alpha * beta; // ⚠️ the result is unused
~~~~~ ^ ~~~~
/home/mf/Repos/CWTS/tests/value_unused_1.cpp:5:8: warning: expression result unused [-Wunused-value]
alpha * beta; // ⚠️ the result is unused
~~~~~ ^ ~~~~
1 warning generated.
[ 81%] Building CXX object CMakeFiles/CWTS.dir/tests/value_unused_2.cpp.o
extern int value_unused_2(int alpha, int beta);
^
int value_unused_2(int alpha, int beta)
^
/home/mf/Repos/CWTS/tests/value_unused_2.cpp:5:9: warning: left operand of comma operator has no effect [clang-diagnostic-unused-value]
return alpha, beta; // ⚠️ only one is used
^~~~~
/home/mf/Repos/CWTS/tests/value_unused_2.cpp:5:9: warning: left operand of comma operator has no effect [-Wunused-value]
return alpha, beta; // ⚠️ only one is used
^~~~~
1 warning generated.
[ 82%] Building CXX object CMakeFiles/CWTS.dir/tests/variable_assignment.cpp.o
extern void variable_assignment();