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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
|
Patch-Source: https://gitlab.com/cmocka/cmocka/-/commit/0e70150002ab7bcb626109b287f23c62ecf97565
--
From 0e70150002ab7bcb626109b287f23c62ecf97565 Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@cryptomilk.org>
Date: Mon, 5 Oct 2020 13:28:11 +0200
Subject: [PATCH] cmocka: Replace LargestIntegralType with uintmax_t
This requires #include <stdint.h>
Fixes #38
Fixes #49
---
example/allocate_module_test.c | 1 +
example/assert_macro_test.c | 1 +
example/assert_module_test.c | 1 +
example/calculator_test.c | 1 +
example/mock/chef_wrap/chef.c | 1 +
example/mock/chef_wrap/waiter_test_wrap.c | 1 +
include/cmocka.h | 162 ++++++++--------------
src/cmocka.c | 148 ++++++++++----------
tests/test_alloc.c | 1 +
tests/test_assert_macros.c | 1 +
tests/test_assert_macros_fail.c | 1 +
tests/test_basics.c | 1 +
tests/test_cmockery.c | 1 +
tests/test_double_macros.c | 1 +
tests/test_exception_handler.c | 1 +
tests/test_fixtures.c | 1 +
tests/test_float_macros.c | 1 +
tests/test_group_fixtures.c | 1 +
tests/test_group_setup_assert.c | 1 +
tests/test_group_setup_fail.c | 1 +
tests/test_groups.c | 1 +
tests/test_ordering.c | 1 +
tests/test_ordering_fail.c | 1 +
tests/test_returns.c | 1 +
tests/test_returns_fail.c | 1 +
tests/test_setup_fail.c | 1 +
tests/test_skip.c | 1 +
tests/test_skip_filter.c | 1 +
tests/test_strmatch.c | 1 +
tests/test_wildcard.c | 1 +
30 files changed, 156 insertions(+), 182 deletions(-)
diff --git a/example/allocate_module_test.c b/example/allocate_module_test.c
index 562aea2..eb3602f 100644
--- example/allocate_module_test.c
+++ example/allocate_module_test.c
@@ -16,6 +16,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
extern void leak_memory(void);
diff --git a/example/assert_macro_test.c b/example/assert_macro_test.c
index 2cd355c..093a884 100644
--- example/assert_macro_test.c
+++ example/assert_macro_test.c
@@ -16,6 +16,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include "assert_macro.h"
diff --git a/example/assert_module_test.c b/example/assert_module_test.c
index f387754..41b5a75 100644
--- example/assert_module_test.c
+++ example/assert_module_test.c
@@ -16,6 +16,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include "assert_module.h"
diff --git a/example/calculator_test.c b/example/calculator_test.c
index ab8cad8..a3d862a 100644
--- example/calculator_test.c
+++ example/calculator_test.c
@@ -16,6 +16,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include "cmocka.h"
#include <stdio.h>
diff --git a/example/mock/chef_wrap/chef.c b/example/mock/chef_wrap/chef.c
index 1429cde..1c74125 100644
--- example/mock/chef_wrap/chef.c
+++ example/mock/chef_wrap/chef.c
@@ -18,6 +18,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <stdio.h>
#include <errno.h>
diff --git a/example/mock/chef_wrap/waiter_test_wrap.c b/example/mock/chef_wrap/waiter_test_wrap.c
index 4146818..04fe721 100644
--- example/mock/chef_wrap/waiter_test_wrap.c
+++ example/mock/chef_wrap/waiter_test_wrap.c
@@ -24,6 +24,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include "waiter_test_wrap.h"
diff --git a/include/cmocka.h b/include/cmocka.h
index a21d965..6f56520 100644
--- include/cmocka.h
+++ include/cmocka.h
@@ -57,32 +57,13 @@ int __stdcall IsDebuggerPresent();
* @{
*/
-/* If __WORDSIZE is not set, try to figure it out and default to 32 bit. */
-#ifndef __WORDSIZE
-# if (defined(__x86_64__) && !defined(__ILP32__)) || defined(__sparc_v9__) || defined(__sparcv9)
-# define __WORDSIZE 64
-# else
-# define __WORDSIZE 32
-# endif
-#endif
+/* XXX: stdint.h is a new requirement to include, but things haven't adapted
+ to it yet, so include it here too.
+ since it's a requirement to use the header at all, there's no harm in
+ including it? */
+#include <stdint.h>
-#ifdef DOXYGEN
-/**
- * Largest integral type. This type should be large enough to hold any
- * pointer or integer supported by the compiler.
- */
-typedef uintmax_t LargestIntegralType;
-#else /* DOXGEN */
-#ifndef LargestIntegralType
-# if __WORDSIZE == 64 && !defined(_WIN64)
-# define LargestIntegralType unsigned long int
-# else
-# define LargestIntegralType unsigned long long int
-# endif
-#endif /* LargestIntegralType */
-#endif /* DOXYGEN */
-
-/* Printf format used to display LargestIntegralType as a hexidecimal. */
+/* Printf format used to display uintmax_t as a hexidecimal. */
#ifndef LargestIntegralTypePrintfFormat
# ifdef _WIN32
# define LargestIntegralTypePrintfFormat "0x%I64x"
@@ -95,7 +76,7 @@ typedef uintmax_t LargestIntegralType;
# endif /* _WIN32 */
#endif /* LargestIntegralTypePrintfFormat */
-/* Printf format used to display LargestIntegralType as a decimal. */
+/* Printf format used to display uintmax_t as a decimal. */
#ifndef LargestIntegralTypePrintfFormatDecimal
# ifdef _WIN32
# define LargestIntegralTypePrintfFormatDecimal "%I64u"
@@ -116,44 +97,15 @@ typedef uintmax_t LargestIntegralType;
# define DoublePrintfFormat "%f"
#endif /* DoublePrintfFormat */
-/* Perform an unsigned cast to LargestIntegralType. */
+/* Perform an unsigned cast to uintmax_t. */
#define cast_to_largest_integral_type(value) \
- ((LargestIntegralType)(value))
-
-/* Smallest integral type capable of holding a pointer. */
-#if !defined(_UINTPTR_T) && !defined(_UINTPTR_T_DEFINED) && !defined(HAVE_UINTPTR_T)
-# if defined(_WIN32)
- /* WIN32 is an ILP32 platform */
- typedef unsigned int uintptr_t;
-# elif defined(_WIN64)
- typedef unsigned long int uintptr_t;
-# else /* _WIN32 */
-
-/* ILP32 and LP64 platforms */
-# ifdef __WORDSIZE /* glibc */
-# if __WORDSIZE == 64
- typedef unsigned long int uintptr_t;
-# else
- typedef unsigned int uintptr_t;
-# endif /* __WORDSIZE == 64 */
-# else /* __WORDSIZE */
-# if defined(_LP64) || defined(_I32LPx)
- typedef unsigned long int uintptr_t;
-# else
- typedef unsigned int uintptr_t;
-# endif
-# endif /* __WORDSIZE */
-# endif /* _WIN32 */
-
-# define _UINTPTR_T
-# define _UINTPTR_T_DEFINED
-#endif /* !defined(_UINTPTR_T) || !defined(_UINTPTR_T_DEFINED) */
+ ((uintmax_t)(value))
/* Perform an unsigned cast to uintptr_t. */
#define cast_to_pointer_integral_type(value) \
- ((uintptr_t)((size_t)(value)))
+ ((uintptr_t)(value))
-/* Perform a cast of a pointer to LargestIntegralType */
+/* Perform a cast of a pointer to uintmax_t */
#define cast_ptr_to_largest_integral_type(value) \
cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
@@ -240,7 +192,7 @@ cast_to_largest_integral_type(cast_to_pointer_integral_type(value))
*
* @see will_return()
*/
-LargestIntegralType mock(void);
+uintmax_t mock(void);
#else
#define mock() _mock(__func__, __FILE__, __LINE__)
#endif
@@ -324,7 +276,7 @@ type mock_ptr_type(#type);
* @see mock()
* @see will_return_count()
*/
-void will_return(#function, LargestIntegralType value);
+void will_return(#function, uintmax_t value);
#else
#define will_return(function, value) \
_will_return(#function, __FILE__, __LINE__, \
@@ -347,7 +299,7 @@ void will_return(#function, LargestIntegralType value);
*
* @see mock()
*/
-void will_return_count(#function, LargestIntegralType value, int count);
+void will_return_count(#function, uintmax_t value, int count);
#else
#define will_return_count(function, value, count) \
_will_return(#function, __FILE__, __LINE__, \
@@ -370,7 +322,7 @@ void will_return_count(#function, LargestIntegralType value, int count);
* @see will_return_count()
* @see mock()
*/
-void will_return_always(#function, LargestIntegralType value);
+void will_return_always(#function, uintmax_t value);
#else
#define will_return_always(function, value) \
will_return_count(function, (value), WILL_RETURN_ALWAYS)
@@ -398,7 +350,7 @@ void will_return_always(#function, LargestIntegralType value);
* @see will_return_count()
* @see mock()
*/
-void will_return_maybe(#function, LargestIntegralType value);
+void will_return_maybe(#function, uintmax_t value);
#else
#define will_return_maybe(function, value) \
will_return_count(function, (value), WILL_RETURN_ONCE)
@@ -494,7 +446,7 @@ void expect_check(#function, #parameter, #check_function, const void *check_data
*
* @see check_expected().
*/
-void expect_in_set(#function, #parameter, LargestIntegralType value_array[]);
+void expect_in_set(#function, #parameter, uintmax_t value_array[]);
#else
#define expect_in_set(function, parameter, value_array) \
expect_in_set_count(function, parameter, value_array, 1)
@@ -519,7 +471,7 @@ void expect_in_set(#function, #parameter, LargestIntegralType value_array[]);
*
* @see check_expected().
*/
-void expect_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
+void expect_in_set_count(#function, #parameter, uintmax_t value_array[], size_t count);
#else
#define expect_in_set_count(function, parameter, value_array, count) \
_expect_in_set(#function, #parameter, __FILE__, __LINE__, value_array, \
@@ -541,7 +493,7 @@ void expect_in_set_count(#function, #parameter, LargestIntegralType value_array[
*
* @see check_expected().
*/
-void expect_not_in_set(#function, #parameter, LargestIntegralType value_array[]);
+void expect_not_in_set(#function, #parameter, uintmax_t value_array[]);
#else
#define expect_not_in_set(function, parameter, value_array) \
expect_not_in_set_count(function, parameter, value_array, 1)
@@ -566,7 +518,7 @@ void expect_not_in_set(#function, #parameter, LargestIntegralType value_array[])
*
* @see check_expected().
*/
-void expect_not_in_set_count(#function, #parameter, LargestIntegralType value_array[], size_t count);
+void expect_not_in_set_count(#function, #parameter, uintmax_t value_array[], size_t count);
#else
#define expect_not_in_set_count(function, parameter, value_array, count) \
_expect_not_in_set( \
@@ -592,7 +544,7 @@ void expect_not_in_set_count(#function, #parameter, LargestIntegralType value_ar
*
* @see check_expected().
*/
-void expect_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
+void expect_in_range(#function, #parameter, uintmax_t minimum, uintmax_t maximum);
#else
#define expect_in_range(function, parameter, minimum, maximum) \
expect_in_range_count(function, parameter, minimum, maximum, 1)
@@ -619,7 +571,7 @@ void expect_in_range(#function, #parameter, LargestIntegralType minimum, Largest
*
* @see check_expected().
*/
-void expect_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
+void expect_in_range_count(#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count);
#else
#define expect_in_range_count(function, parameter, minimum, maximum, count) \
_expect_in_range(#function, #parameter, __FILE__, __LINE__, minimum, \
@@ -643,7 +595,7 @@ void expect_in_range_count(#function, #parameter, LargestIntegralType minimum, L
*
* @see check_expected().
*/
-void expect_not_in_range(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum);
+void expect_not_in_range(#function, #parameter, uintmax_t minimum, uintmax_t maximum);
#else
#define expect_not_in_range(function, parameter, minimum, maximum) \
expect_not_in_range_count(function, parameter, minimum, maximum, 1)
@@ -670,7 +622,7 @@ void expect_not_in_range(#function, #parameter, LargestIntegralType minimum, Lar
*
* @see check_expected().
*/
-void expect_not_in_range_count(#function, #parameter, LargestIntegralType minimum, LargestIntegralType maximum, size_t count);
+void expect_not_in_range_count(#function, #parameter, uintmax_t minimum, uintmax_t maximum, size_t count);
#else
#define expect_not_in_range_count(function, parameter, minimum, maximum, \
count) \
@@ -695,7 +647,7 @@ void expect_not_in_range_count(#function, #parameter, LargestIntegralType minimu
* @see expect_memory()
* @see expect_any()
*/
-void expect_value(#function, #parameter, LargestIntegralType value);
+void expect_value(#function, #parameter, uintmax_t value);
#else
#define expect_value(function, parameter, value) \
expect_value_count(function, parameter, value, 1)
@@ -722,7 +674,7 @@ void expect_value(#function, #parameter, LargestIntegralType value);
* @see expect_not_string()
* @see expect_not_memory()
*/
-void expect_value_count(#function, #parameter, LargestIntegralType value, size_t count);
+void expect_value_count(#function, #parameter, uintmax_t value, size_t count);
#else
#define expect_value_count(function, parameter, value, count) \
_expect_value(#function, #parameter, __FILE__, __LINE__, \
@@ -743,7 +695,7 @@ void expect_value_count(#function, #parameter, LargestIntegralType value, size_t
*
* @see check_expected().
*/
-void expect_not_value(#function, #parameter, LargestIntegralType value);
+void expect_not_value(#function, #parameter, uintmax_t value);
#else
#define expect_not_value(function, parameter, value) \
expect_not_value_count(function, parameter, value, 1)
@@ -767,7 +719,7 @@ void expect_not_value(#function, #parameter, LargestIntegralType value);
*
* @see check_expected().
*/
-void expect_not_value_count(#function, #parameter, LargestIntegralType value, size_t count);
+void expect_not_value_count(#function, #parameter, uintmax_t value, size_t count);
#else
#define expect_not_value_count(function, parameter, value, count) \
_expect_not_value(#function, #parameter, __FILE__, __LINE__, \
@@ -1438,7 +1390,7 @@ void assert_memory_not_equal(const void *a, const void *b, size_t size);
*
* @param[in] maximum The maximum value allowed.
*/
-void assert_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum);
+void assert_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
#else
#define assert_in_range(value, minimum, maximum) \
_assert_in_range( \
@@ -1461,7 +1413,7 @@ void assert_in_range(LargestIntegralType value, LargestIntegralType minimum, Lar
*
* @param[in] maximum The maximum value to compare.
*/
-void assert_not_in_range(LargestIntegralType value, LargestIntegralType minimum, LargestIntegralType maximum);
+void assert_not_in_range(uintmax_t value, uintmax_t minimum, uintmax_t maximum);
#else
#define assert_not_in_range(value, minimum, maximum) \
_assert_not_in_range( \
@@ -1483,7 +1435,7 @@ void assert_not_in_range(LargestIntegralType value, LargestIntegralType minimum,
*
* @param[in] count The size of the values array.
*/
-void assert_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count);
+void assert_in_set(uintmax_t value, uintmax_t values[], size_t count);
#else
#define assert_in_set(value, values, number_of_values) \
_assert_in_set(value, values, number_of_values, __FILE__, __LINE__)
@@ -1502,7 +1454,7 @@ void assert_in_set(LargestIntegralType value, LargestIntegralType values[], size
*
* @param[in] count The size of the values array.
*/
-void assert_not_in_set(LargestIntegralType value, LargestIntegralType values[], size_t count);
+void assert_not_in_set(uintmax_t value, uintmax_t values[], size_t count);
#else
#define assert_not_in_set(value, values, number_of_values) \
_assert_not_in_set(value, values, number_of_values, __FILE__, __LINE__)
@@ -2181,8 +2133,8 @@ void expect_assert_failure(function fn_call);
typedef void (*UnitTestFunction)(void **state);
/* Function that determines whether a function parameter value is correct. */
-typedef int (*CheckParameterValue)(const LargestIntegralType value,
- const LargestIntegralType check_value_data);
+typedef int (*CheckParameterValue)(const uintmax_t value,
+ const uintmax_t check_value_data);
/* Type of the unit test function. */
typedef enum UnitTestFunctionType {
@@ -2236,7 +2188,7 @@ typedef struct CheckParameterEvent {
SourceLocation location;
const char *parameter_name;
CheckParameterValue check_value;
- LargestIntegralType check_value_data;
+ uintmax_t check_value_data;
} CheckParameterEvent;
/* Used by expect_assert_failure() and mock_assert(). */
@@ -2245,7 +2197,7 @@ extern jmp_buf global_expect_assert_env;
extern const char * global_last_failed_assert;
/* Retrieves a value for the given function, as set by "will_return". */
-LargestIntegralType _mock(const char * const function, const char* const file,
+uintmax_t _mock(const char * const function, const char* const file,
const int line);
void _expect_function_call(
@@ -2261,36 +2213,36 @@ void _expect_check(
const char* const function, const char* const parameter,
const char* const file, const int line,
const CheckParameterValue check_function,
- const LargestIntegralType check_data, CheckParameterEvent * const event,
+ const uintmax_t check_data, CheckParameterEvent * const event,
const int count);
void _expect_in_set(
const char* const function, const char* const parameter,
- const char* const file, const int line, const LargestIntegralType values[],
+ const char* const file, const int line, const uintmax_t values[],
const size_t number_of_values, const int count);
void _expect_not_in_set(
const char* const function, const char* const parameter,
- const char* const file, const int line, const LargestIntegralType values[],
+ const char* const file, const int line, const uintmax_t values[],
const size_t number_of_values, const int count);
void _expect_in_range(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType minimum,
- const LargestIntegralType maximum, const int count);
+ const uintmax_t minimum,
+ const uintmax_t maximum, const int count);
void _expect_not_in_range(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType minimum,
- const LargestIntegralType maximum, const int count);
+ const uintmax_t minimum,
+ const uintmax_t maximum, const int count);
void _expect_value(
const char* const function, const char* const parameter,
- const char* const file, const int line, const LargestIntegralType value,
+ const char* const file, const int line, const uintmax_t value,
const int count);
void _expect_not_value(
const char* const function, const char* const parameter,
- const char* const file, const int line, const LargestIntegralType value,
+ const char* const file, const int line, const uintmax_t value,
const int count);
void _expect_string(
@@ -2317,17 +2269,17 @@ void _expect_any(
void _check_expected(
const char * const function_name, const char * const parameter_name,
- const char* file, const int line, const LargestIntegralType value);
+ const char* file, const int line, const uintmax_t value);
void _will_return(const char * const function_name, const char * const file,
- const int line, const LargestIntegralType value,
+ const int line, const uintmax_t value,
const int count);
-void _assert_true(const LargestIntegralType result,
+void _assert_true(const uintmax_t result,
const char* const expression,
const char * const file, const int line);
-void _assert_return_code(const LargestIntegralType result,
+void _assert_return_code(const uintmax_t result,
size_t rlen,
- const LargestIntegralType error,
+ const uintmax_t error,
const char * const expression,
const char * const file,
const int line);
@@ -2344,10 +2296,10 @@ void _assert_double_not_equal(const double a, const double n,
const double epsilon, const char* const file,
const int line);
void _assert_int_equal(
- const LargestIntegralType a, const LargestIntegralType b,
+ const uintmax_t a, const uintmax_t b,
const char * const file, const int line);
void _assert_int_not_equal(
- const LargestIntegralType a, const LargestIntegralType b,
+ const uintmax_t a, const uintmax_t b,
const char * const file, const int line);
void _assert_string_equal(const char * const a, const char * const b,
const char * const file, const int line);
@@ -2360,16 +2312,16 @@ void _assert_memory_not_equal(const void * const a, const void * const b,
const size_t size, const char* const file,
const int line);
void _assert_in_range(
- const LargestIntegralType value, const LargestIntegralType minimum,
- const LargestIntegralType maximum, const char* const file, const int line);
+ const uintmax_t value, const uintmax_t minimum,
+ const uintmax_t maximum, const char* const file, const int line);
void _assert_not_in_range(
- const LargestIntegralType value, const LargestIntegralType minimum,
- const LargestIntegralType maximum, const char* const file, const int line);
+ const uintmax_t value, const uintmax_t minimum,
+ const uintmax_t maximum, const char* const file, const int line);
void _assert_in_set(
- const LargestIntegralType value, const LargestIntegralType values[],
+ const uintmax_t value, const uintmax_t values[],
const size_t number_of_values, const char* const file, const int line);
void _assert_not_in_set(
- const LargestIntegralType value, const LargestIntegralType values[],
+ const uintmax_t value, const uintmax_t values[],
const size_t number_of_values, const char* const file, const int line);
void* _test_malloc(const size_t size, const char* file, const int line);
diff --git a/src/cmocka.c b/src/cmocka.c
index 52897e1..62d4284 100644
--- src/cmocka.c
+++ src/cmocka.c
@@ -1,6 +1,6 @@
/*
* Copyright 2008 Google Inc.
- * Copyright 2014-2018 Andreas Schneider <asn@cryptomilk.org>
+ * Copyright 2014-2020 Andreas Schneider <asn@cryptomilk.org>
* Copyright 2015 Jakub Hrozek <jakub.hrozek@posteo.se>
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -111,14 +111,14 @@
/*
- * Declare and initialize a LargestIntegralType variable name
+ * Declare and initialize a uintmax_t variable name
* with value the conversion of ptr.
*/
#define declare_initialize_value_pointer_pointer(name, ptr) \
- LargestIntegralType name ; \
- name = (LargestIntegralType) (uintptr_t) ptr
+ uintmax_t name ; \
+ name = (uintmax_t)((uintptr_t)(ptr))
-/* Cast a LargestIntegralType to pointer_type. */
+/* Cast a uintmax_t to pointer_type. */
#define cast_largest_integral_type_to_pointer( \
pointer_type, largest_integral_type) \
((pointer_type)(uintptr_t)(largest_integral_type))
@@ -158,7 +158,7 @@ typedef int (*EqualityFunction)(const void *left, const void *right);
/* Value of a symbol and the place it was declared. */
typedef struct SymbolValue {
SourceLocation location;
- LargestIntegralType value;
+ uintmax_t value;
} SymbolValue;
/*
@@ -183,14 +183,14 @@ typedef void (*CleanupListValue)(const void *value, void *cleanup_value_data);
/* Structure used to check the range of integer types.a */
typedef struct CheckIntegerRange {
CheckParameterEvent event;
- LargestIntegralType minimum;
- LargestIntegralType maximum;
+ uintmax_t minimum;
+ uintmax_t maximum;
} CheckIntegerRange;
/* Structure used to check whether an integer value is in a set. */
typedef struct CheckIntegerSet {
CheckParameterEvent event;
- const LargestIntegralType *set;
+ const uintmax_t *set;
size_t size_of_set;
} CheckIntegerSet;
@@ -702,7 +702,7 @@ static void free_value(const void *value, void *cleanup_value_data) {
static void free_symbol_map_value(const void *value,
void *cleanup_value_data) {
SymbolMapValue * const map_value = (SymbolMapValue*)value;
- const LargestIntegralType children = cast_ptr_to_largest_integral_type(cleanup_value_data);
+ const uintmax_t children = cast_ptr_to_largest_integral_type(cleanup_value_data);
assert_non_null(value);
if (children == 0) {
list_free(&map_value->symbol_values_list_head,
@@ -947,14 +947,14 @@ static size_t check_for_leftover_values(
/* Get the next return value for the specified mock function. */
-LargestIntegralType _mock(const char * const function, const char* const file,
+uintmax_t _mock(const char * const function, const char* const file,
const int line) {
void *result;
const int rc = get_symbol_value(&global_function_result_map_head,
&function, 1, &result);
if (rc) {
SymbolValue * const symbol = (SymbolValue*)result;
- const LargestIntegralType value = symbol->value;
+ const uintmax_t value = symbol->value;
global_last_mock_value_location = symbol->location;
if (rc == 1) {
free(symbol);
@@ -1055,7 +1055,7 @@ void _function_called(const char *const function,
/* Add a return value for the specified mock function name. */
void _will_return(const char * const function_name, const char * const file,
- const int line, const LargestIntegralType value,
+ const int line, const uintmax_t value,
const int count) {
SymbolValue * const return_value =
(SymbolValue*)malloc(sizeof(*return_value));
@@ -1077,7 +1077,7 @@ void _expect_check(
const char* const function, const char* const parameter,
const char* const file, const int line,
const CheckParameterValue check_function,
- const LargestIntegralType check_data,
+ const uintmax_t check_data,
CheckParameterEvent * const event, const int count) {
CheckParameterEvent * const check =
event ? event : (CheckParameterEvent*)malloc(sizeof(*check));
@@ -1241,8 +1241,8 @@ static int double_values_not_equal_display_error(const double left,
/* Returns 1 if the specified values are equal. If the values are not equal
* an error is displayed and 0 is returned. */
-static int values_equal_display_error(const LargestIntegralType left,
- const LargestIntegralType right) {
+static int values_equal_display_error(const uintmax_t left,
+ const uintmax_t right) {
const int equal = left == right;
if (!equal) {
cm_print_error(LargestIntegralTypePrintfFormat " != "
@@ -1254,8 +1254,8 @@ static int values_equal_display_error(const LargestIntegralType left,
/*
* Returns 1 if the specified values are not equal. If the values are equal
* an error is displayed and 0 is returned. */
-static int values_not_equal_display_error(const LargestIntegralType left,
- const LargestIntegralType right) {
+static int values_not_equal_display_error(const uintmax_t left,
+ const uintmax_t right) {
const int not_equal = left != right;
if (!not_equal) {
cm_print_error(LargestIntegralTypePrintfFormat " == "
@@ -1273,12 +1273,12 @@ static int values_not_equal_display_error(const LargestIntegralType left,
* displayed.
*/
static int value_in_set_display_error(
- const LargestIntegralType value,
+ const uintmax_t value,
const CheckIntegerSet * const check_integer_set, const int invert) {
int succeeded = invert;
assert_non_null(check_integer_set);
{
- const LargestIntegralType * const set = check_integer_set->set;
+ const uintmax_t * const set = check_integer_set->set;
const size_t size_of_set = check_integer_set->size_of_set;
size_t i;
for (i = 0; i < size_of_set; i++) {
@@ -1310,8 +1310,8 @@ static int value_in_set_display_error(
* specified range an error is displayed and 0 is returned.
*/
static int integer_in_range_display_error(
- const LargestIntegralType value, const LargestIntegralType range_min,
- const LargestIntegralType range_max) {
+ const uintmax_t value, const uintmax_t range_min,
+ const uintmax_t range_max) {
if (value >= range_min && value <= range_max) {
return 1;
}
@@ -1330,8 +1330,8 @@ static int integer_in_range_display_error(
* specified range an error is displayed and zero is returned.
*/
static int integer_not_in_range_display_error(
- const LargestIntegralType value, const LargestIntegralType range_min,
- const LargestIntegralType range_max) {
+ const uintmax_t value, const uintmax_t range_min,
+ const uintmax_t range_max) {
if (value < range_min || value > range_max) {
return 1;
}
@@ -1431,8 +1431,8 @@ static int memory_not_equal_display_error(
/* CheckParameterValue callback to check whether a value is within a set. */
-static int check_in_set(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_in_set(const uintmax_t value,
+ const uintmax_t check_value_data) {
return value_in_set_display_error(value,
cast_largest_integral_type_to_pointer(CheckIntegerSet*,
check_value_data), 0);
@@ -1440,8 +1440,8 @@ static int check_in_set(const LargestIntegralType value,
/* CheckParameterValue callback to check whether a value isn't within a set. */
-static int check_not_in_set(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_not_in_set(const uintmax_t value,
+ const uintmax_t check_value_data) {
return value_in_set_display_error(value,
cast_largest_integral_type_to_pointer(CheckIntegerSet*,
check_value_data), 1);
@@ -1453,12 +1453,12 @@ static int check_not_in_set(const LargestIntegralType value,
static void expect_set(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType values[], const size_t number_of_values,
+ const uintmax_t values[], const size_t number_of_values,
const CheckParameterValue check_function, const int count) {
CheckIntegerSet * const check_integer_set =
(CheckIntegerSet*)malloc(sizeof(*check_integer_set) +
(sizeof(values[0]) * number_of_values));
- LargestIntegralType * const set = (LargestIntegralType*)(
+ uintmax_t * const set = (uintmax_t*)(
check_integer_set + 1);
declare_initialize_value_pointer_pointer(check_data, check_integer_set);
assert_non_null(values);
@@ -1476,7 +1476,7 @@ static void expect_set(
void _expect_in_set(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType values[], const size_t number_of_values,
+ const uintmax_t values[], const size_t number_of_values,
const int count) {
expect_set(function, parameter, file, line, values, number_of_values,
check_in_set, count);
@@ -1487,7 +1487,7 @@ void _expect_in_set(
void _expect_not_in_set(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType values[], const size_t number_of_values,
+ const uintmax_t values[], const size_t number_of_values,
const int count) {
expect_set(function, parameter, file, line, values, number_of_values,
check_not_in_set, count);
@@ -1495,8 +1495,8 @@ void _expect_not_in_set(
/* CheckParameterValue callback to check whether a value is within a range. */
-static int check_in_range(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_in_range(const uintmax_t value,
+ const uintmax_t check_value_data) {
CheckIntegerRange * const check_integer_range =
cast_largest_integral_type_to_pointer(CheckIntegerRange*,
check_value_data);
@@ -1507,8 +1507,8 @@ static int check_in_range(const LargestIntegralType value,
/* CheckParameterValue callback to check whether a value is not within a range. */
-static int check_not_in_range(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_not_in_range(const uintmax_t value,
+ const uintmax_t check_value_data) {
CheckIntegerRange * const check_integer_range =
cast_largest_integral_type_to_pointer(CheckIntegerRange*,
check_value_data);
@@ -1523,7 +1523,7 @@ static int check_not_in_range(const LargestIntegralType value,
static void expect_range(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType minimum, const LargestIntegralType maximum,
+ const uintmax_t minimum, const uintmax_t maximum,
const CheckParameterValue check_function, const int count) {
CheckIntegerRange * const check_integer_range =
(CheckIntegerRange*)malloc(sizeof(*check_integer_range));
@@ -1539,7 +1539,7 @@ static void expect_range(
void _expect_in_range(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType minimum, const LargestIntegralType maximum,
+ const uintmax_t minimum, const uintmax_t maximum,
const int count) {
expect_range(function, parameter, file, line, minimum, maximum,
check_in_range, count);
@@ -1550,7 +1550,7 @@ void _expect_in_range(
void _expect_not_in_range(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType minimum, const LargestIntegralType maximum,
+ const uintmax_t minimum, const uintmax_t maximum,
const int count) {
expect_range(function, parameter, file, line, minimum, maximum,
check_not_in_range, count);
@@ -1559,8 +1559,8 @@ void _expect_not_in_range(
/* CheckParameterValue callback to check whether a value is equal to an
* expected value. */
-static int check_value(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_value(const uintmax_t value,
+ const uintmax_t check_value_data) {
return values_equal_display_error(value, check_value_data);
}
@@ -1569,7 +1569,7 @@ static int check_value(const LargestIntegralType value,
void _expect_value(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType value, const int count) {
+ const uintmax_t value, const int count) {
_expect_check(function, parameter, file, line, check_value, value, NULL,
count);
}
@@ -1577,8 +1577,8 @@ void _expect_value(
/* CheckParameterValue callback to check whether a value is not equal to an
* expected value. */
-static int check_not_value(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_not_value(const uintmax_t value,
+ const uintmax_t check_value_data) {
return values_not_equal_display_error(value, check_value_data);
}
@@ -1587,15 +1587,15 @@ static int check_not_value(const LargestIntegralType value,
void _expect_not_value(
const char* const function, const char* const parameter,
const char* const file, const int line,
- const LargestIntegralType value, const int count) {
+ const uintmax_t value, const int count) {
_expect_check(function, parameter, file, line, check_not_value, value,
NULL, count);
}
/* CheckParameterValue callback to check whether a parameter equals a string. */
-static int check_string(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_string(const uintmax_t value,
+ const uintmax_t check_value_data) {
return string_equal_display_error(
cast_largest_integral_type_to_pointer(char*, value),
cast_largest_integral_type_to_pointer(char*, check_value_data));
@@ -1616,8 +1616,8 @@ void _expect_string(
/* CheckParameterValue callback to check whether a parameter is not equals to
* a string. */
-static int check_not_string(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_not_string(const uintmax_t value,
+ const uintmax_t check_value_data) {
return string_not_equal_display_error(
cast_largest_integral_type_to_pointer(char*, value),
cast_largest_integral_type_to_pointer(char*, check_value_data));
@@ -1637,8 +1637,8 @@ void _expect_not_string(
/* CheckParameterValue callback to check whether a parameter equals an area of
* memory. */
-static int check_memory(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_memory(const uintmax_t value,
+ const uintmax_t check_value_data) {
CheckMemoryData * const check = cast_largest_integral_type_to_pointer(
CheckMemoryData*, check_value_data);
assert_non_null(check);
@@ -1681,8 +1681,8 @@ void _expect_memory(
/* CheckParameterValue callback to check whether a parameter is not equal to
* an area of memory. */
-static int check_not_memory(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_not_memory(const uintmax_t value,
+ const uintmax_t check_value_data) {
CheckMemoryData * const check = cast_largest_integral_type_to_pointer(
CheckMemoryData*, check_value_data);
assert_non_null(check);
@@ -1704,8 +1704,8 @@ void _expect_not_memory(
/* CheckParameterValue callback that always returns 1. */
-static int check_any(const LargestIntegralType value,
- const LargestIntegralType check_value_data) {
+static int check_any(const uintmax_t value,
+ const uintmax_t check_value_data) {
(void)value;
(void)check_value_data;
return 1;
@@ -1723,7 +1723,7 @@ void _expect_any(
void _check_expected(
const char * const function_name, const char * const parameter_name,
- const char* file, const int line, const LargestIntegralType value) {
+ const char* file, const int line, const uintmax_t value) {
void *result = NULL;
const char* symbols[] = {function_name, parameter_name};
const int rc = get_symbol_value(&global_function_parameter_map_head,
@@ -1780,7 +1780,7 @@ void mock_assert(const int result, const char* const expression,
}
-void _assert_true(const LargestIntegralType result,
+void _assert_true(const uintmax_t result,
const char * const expression,
const char * const file, const int line) {
if (!result) {
@@ -1789,14 +1789,14 @@ void _assert_true(const LargestIntegralType result,
}
}
-void _assert_return_code(const LargestIntegralType result,
+void _assert_return_code(const uintmax_t result,
size_t rlen,
- const LargestIntegralType error,
+ const uintmax_t error,
const char * const expression,
const char * const file,
const int line)
{
- LargestIntegralType valmax;
+ uintmax_t valmax;
switch (rlen) {
@@ -1872,7 +1872,7 @@ void _assert_double_not_equal(const double a,
}
void _assert_int_equal(
- const LargestIntegralType a, const LargestIntegralType b,
+ const uintmax_t a, const uintmax_t b,
const char * const file, const int line) {
if (!values_equal_display_error(a, b)) {
_fail(file, line);
@@ -1881,7 +1881,7 @@ void _assert_int_equal(
void _assert_int_not_equal(
- const LargestIntegralType a, const LargestIntegralType b,
+ const uintmax_t a, const uintmax_t b,
const char * const file, const int line) {
if (!values_not_equal_display_error(a, b)) {
_fail(file, line);
@@ -1925,8 +1925,8 @@ void _assert_memory_not_equal(const void * const a, const void * const b,
void _assert_in_range(
- const LargestIntegralType value, const LargestIntegralType minimum,
- const LargestIntegralType maximum, const char* const file,
+ const uintmax_t value, const uintmax_t minimum,
+ const uintmax_t maximum, const char* const file,
const int line) {
if (!integer_in_range_display_error(value, minimum, maximum)) {
_fail(file, line);
@@ -1934,16 +1934,16 @@ void _assert_in_range(
}
void _assert_not_in_range(
- const LargestIntegralType value, const LargestIntegralType minimum,
- const LargestIntegralType maximum, const char* const file,
+ const uintmax_t value, const uintmax_t minimum,
+ const uintmax_t maximum, const char* const file,
const int line) {
if (!integer_not_in_range_display_error(value, minimum, maximum)) {
_fail(file, line);
}
}
-void _assert_in_set(const LargestIntegralType value,
- const LargestIntegralType values[],
+void _assert_in_set(const uintmax_t value,
+ const uintmax_t values[],
const size_t number_of_values, const char* const file,
const int line) {
CheckIntegerSet check_integer_set;
@@ -1954,8 +1954,8 @@ void _assert_in_set(const LargestIntegralType value,
}
}
-void _assert_not_in_set(const LargestIntegralType value,
- const LargestIntegralType values[],
+void _assert_not_in_set(const uintmax_t value,
+ const uintmax_t values[],
const size_t number_of_values, const char* const file,
const int line) {
CheckIntegerSet check_integer_set;
@@ -3079,8 +3079,8 @@ int _cmocka_run_group_tests(const char *group_name,
size_t i;
int rc;
- /* Make sure LargestIntegralType is at least the size of a pointer. */
- assert_true(sizeof(LargestIntegralType) >= sizeof(void*));
+ /* Make sure uintmax_t is at least the size of a pointer. */
+ assert_true(sizeof(uintmax_t) >= sizeof(void*));
cm_tests = libc_calloc(1, sizeof(struct CMUnitTestState) * num_tests);
if (cm_tests == NULL) {
@@ -3370,8 +3370,8 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
print_message("[==========] Running %"PRIdS " test(s).\n",
number_of_tests - setups - teardowns);
- /* Make sure LargestIntegralType is at least the size of a pointer. */
- assert_true(sizeof(LargestIntegralType) >= sizeof(void*));
+ /* Make sure uintmax_t is at least the size of a pointer. */
+ assert_true(sizeof(uintmax_t) >= sizeof(void*));
while (current_test < number_of_tests) {
const ListNode *test_check_point = NULL;
diff --git a/tests/test_alloc.c b/tests/test_alloc.c
index 966814a..3948084 100644
--- tests/test_alloc.c
+++ tests/test_alloc.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_assert_macros.c b/tests/test_assert_macros.c
index 1a00880..3a7a0fe 100644
--- tests/test_assert_macros.c
+++ tests/test_assert_macros.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_assert_macros_fail.c b/tests/test_assert_macros_fail.c
index aea919a..fc354d4 100644
--- tests/test_assert_macros_fail.c
+++ tests/test_assert_macros_fail.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_basics.c b/tests/test_basics.c
inde 1bb493f..9866d81 100644
--- tests/test_basics.c
+++ tests/test_basics.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int setup(void **state) {
diff --git a/tests/test_cmockery.c b/tests/test_cmockery.c
index 83a7451..027b1ac 100644
--- tests/test_cmockery.c
+++ tests/test_cmockery.c
@@ -17,6 +17,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmockery/cmockery.h>
/* A test case that does nothing and succeeds. */
diff --git a/tests/test_double_macros.c b/tests/test_double_macros.c
index 138c579..b892272 100644
--- tests/test_double_macros.c
+++ tests/test_double_macros.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
/* A test case that does check if double is equal. */
diff --git a/tests/test_exception_handler.c b/tests/test_exception_handler.c
index 23c19cd..769eed8 100644
--- tests/test_exception_handler.c
+++ tests/test_exception_handler.c
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <signal.h>
diff --git a/tests/test_fixtures.c b/tests/test_fixtures.c
index 6d39487..e6d05d1 100644
--- tests/test_fixtures.c
+++ tests/test_fixtures.c
@@ -1,6 +1,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <stdlib.h>
diff --git a/tests/test_float_macros.c b/tests/test_float_macros.c
index a9c7251..6ce8906 100644
--- tests/test_float_macros.c
+++ tests/test_float_macros.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
/* A test case that does check if float is equal. */
diff --git a/tests/test_group_fixtures.c b/tests/test_group_fixtures.c
index 64f0ab7..e9b4ad3 100644
--- tests/test_group_fixtures.c
+++ tests/test_group_fixtures.c
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int group_setup(void **state)
diff --git a/tests/test_group_setup_assert.c b/tests/test_group_setup_assert.c
index eef61f8..92f88b6 100644
--- tests/test_group_setup_assert.c
+++ tests/test_group_setup_assert.c
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int group_setup_failing(void **state)
diff --git a/tests/test_group_setup_fail.c b/tests/test_group_setup_fail.c
index 7815c03..1f2e701 100644
--- tests/test_group_setup_fail.c
+++ tests/test_group_setup_fail.c
@@ -4,6 +4,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int group_setup_failing(void **state)
diff --git a/tests/test_groups.c b/tests/test_groups.c
index af9e2b8..ea936c0 100644
--- tests/test_groups.c
+++ tests/test_groups.c
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int setup(void **state) {
diff --git a/tests/test_ordering.c b/tests/test_ordering.c
index 817c0ba..fab2568 100644
--- tests/test_ordering.c
+++ tests/test_ordering.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_ordering_fail.c b/tests/test_ordering_fail.c
index 652f5ad..88b4e29 100644
--- tests/test_ordering_fail.c
+++ tests/test_ordering_fail.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_returns.c b/tests/test_returns.c
index b9370c9..574fa00 100644
--- tests/test_returns.c
+++ tests/test_returns.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_returns_fail.c b/tests/test_returns_fail.c
index 81197d3..fa7f291 100644
--- tests/test_returns_fail.c
+++ tests/test_returns_fail.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include <cmocka_private.h>
diff --git a/tests/test_setup_fail.c b/tests/test_setup_fail.c
index e3f8df8..9affaa6 100644
--- tests/test_setup_fail.c
+++ tests/test_setup_fail.c
@@ -3,6 +3,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static int setup_fail(void **state) {
diff --git a/tests/test_skip.c b/tests/test_skip.c
index 127161a..0a6953d 100644
--- tests/test_skip.c
+++ tests/test_skip.c
@@ -17,6 +17,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
/* A test case that does check if an int is equal. */
diff --git a/tests/test_skip_filter.c b/tests/test_skip_filter.c
index e40209e..56dc262 100644
--- tests/test_skip_filter.c
+++ tests/test_skip_filter.c
@@ -19,6 +19,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static void test_skip1(void **state)
diff --git a/tests/test_strmatch.c b/tests/test_strmatch.c
index f2d966b..f8d088c 100644
--- tests/test_strmatch.c
+++ tests/test_strmatch.c
@@ -19,6 +19,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
#include "../src/cmocka.c"
diff --git a/tests/test_wildcard.c b/tests/test_wildcard.c
index 10ee195..3b85bb3 100644
--- tests/test_wildcard.c
+++ tests/test_wildcard.c
@@ -17,6 +17,7 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
+#include <stdint.h>
#include <cmocka.h>
static void test_ok1(void **state)
|