Commit Graph

111 Commits

Author SHA1 Message Date
Farkasvölgyi
2230e3e9b1 ignore sanitizer 2019-05-23 22:05:00 +02:00
Farkasvölgyi
ce02456a76 Add ASSERT_WSTR 2019-05-23 22:05:00 +02:00
Farkasvölgyi
f501ac200f Add ASSERT_WSTR 2019-05-23 22:05:00 +02:00
Bas van den Berg
0f3f58018c example: removed usleep since it seems to cause issues on Windows 2018-04-04 21:44:12 +02:00
Mike Gelfand
c39ed2245d Use C99 snprintf instead of sprintf
Since we're already using `vsnprintf` and other C99 features, it's only
natural to use `snprintf` as well. Moreover, `sprintf` is "deprecated" in
Microsoft's CRT in favor of more secure (Microsoft-specific) alternatives
with its use resulting in a warning, while `snprintf` isn't (although
requires recent enough CRT).
2018-04-04 21:36:58 +02:00
Mike Gelfand
b8f1802522 Eliminate use of empty struct in test code
Where GCC and Clang issue warnings such as "empty struct is a GNU extension"
(with `-Wgnu-empty-struct`) or "empty struct has size 0 in C, size 1 in C++"
(with `-Wc++-compat`), MSVC issues an error C2016 "C requires that a struct
or union has at least one member".
2018-03-31 16:18:01 +03:00
Andrew Eckel
a0d3adb693 Move tentative callback definitions into CTEST_DATA and remove -Wredundant-decls pragmas 2018-03-29 08:24:57 +02:00
Andrew Eckel
4ff744cc25 Remove gratuitous parens 2018-03-28 22:15:09 +02:00
Bas van den Berg
b0891e0640 move setup/teardown forward decls to CTEST_DATA 2018-03-28 22:05:20 +02:00
Andrew Eckel
6ae86e9ca5 Replace weak-linkage strategy for handling undefined setup/teardown callbacks with a standard C strategy using tentative definitions 2018-03-28 21:07:22 +02:00
Andrew Eckel
a900b3b3c7 Refactor pragma's for warning control 2018-03-28 21:07:22 +02:00
Bas van den Berg
0982423706 Copyright: update for 2018 2018-03-28 21:07:03 +02:00
Bas van den Berg
904dc560a3 removed empty line 2018-03-28 20:58:44 +02:00
Andrew Eckel
07db910d5e Add -Wshadow to CCFLAGS 2018-03-25 15:22:13 -04:00
Andrew Eckel
d911807f0b Suppress -Wshadow warning by renaming a local variable 'index', which may shadow the standard library function of the same name. 2018-03-11 21:46:46 -04:00
Matt Kelly
7ae25126a6 Convert tabs to spaces in header 2017-07-25 22:59:03 -04:00
Bas van den Berg
5478fff272 legal: changed copyright msg 2016 -> 2017 2017-04-18 22:36:38 +02:00
Bas van den Berg
ddef685e3e Makefile: added compiler warning flags 2017-04-18 22:18:36 +02:00
Mike Gelfand
92ae0d9cb5 Declare own data variable for each test case
This eliminates "redundant redeclaration of '..._data' [-Wredundant-decls]"
GCC warnings.
2017-03-05 21:33:55 +03:00
Mike Gelfand
616c99cb3f Move setup/teardown function declarations to CTEST_DATA macro
This eliminates "redundant redeclaration of '..._setup' [-Wredundant-decls]"
and "redundant redeclaration of '..._teardown' [-Wredundant-decls]" GCC
warnings.
2017-03-05 21:32:54 +03:00
Bas van den Berg
99c916e2d8 Makefile: use $CC instead of hardcoded gcc 2017-03-05 13:41:02 +01:00
Bas van den Berg
0ea727141b Merge branch 'mikedld-warnings-elimination' 2017-03-05 13:40:50 +01:00
Mike Gelfand
301626b2b2 Make function declarations proper prototypes
Where not possible (as with `ctest::run`), suppress the warning.

This eliminates "function declaration isn't a prototype [-Wstrict-prototypes]"
GCC warning.
2017-03-05 12:59:23 +03:00
Mike Gelfand
f5525fe227 Don't inline non-inlinable functions
This eliminates "function '...' can never be inlined because it uses variable
argument lists [-Winline]" and "inlining failed in call to '...': function
not inlinable [-Winline]" GCC warnings.
2017-03-05 12:55:12 +03:00
Mike Gelfand
5bb5e4310f Suppress noreturn attribute suggestion
Marking `CTEST_ERR` function as noreturn leads to same warning appearing
for `ctest_fail` function; marking the latter as noreturn as well leads
to warnings in user test cases which is not something we want.

This eliminates "function 'CTEST_ERR' could be declared with attribute
'noreturn' [-Wmissing-noreturn]" Clang warning.
2017-03-04 23:14:40 +03:00
Mike Gelfand
e5d42fc3c3 Reorder ctest struct fields for better packing
This resulted in gaps between `ctest` structs with GCC on amd64, so adding
aligned(1) attribute to the section fix this.

This eliminates "padding struct 'struct ctest' with 4 bytes to align 'data'
[-Wpadded]" and "padding size of 'struct ctest' with 4 bytes to alignment
boundary [-Wpadded]" Clang warnings.
2017-03-04 23:02:01 +03:00
Mike Gelfand
fb62076f4f Mark printf-like functions as such
This eliminates "format string is not a string literal [-Wformat-nonliteral]"
(and after that "format specifies type 'void *' but the argument has type
'... *' [-Wformat-pedantic]") Clang warning.
2017-03-04 22:12:30 +03:00
Mike Gelfand
7ca2060993 Explicitly mark data variable unused
Not using `__attribute__((unused))` as I think the warning could be useful:
if one is using CTEST2, they should be using `data`.

This eliminates "unused parameter '...' [-Wunused-parameter]" GCC/Clang
warning.
2017-03-04 21:55:35 +03:00
Mike Gelfand
26ab614fac Declare test case functions static
Provide prototypes for setup and teardown test case functions as making
them static is not possible due to weak linking.

Provide prototype for ctest_main function as making it static might break
existing code if someone does `#define ctest_main main`.

This eliminates "no previous prototype for function '...'
[-Wmissing-prototypes]" Clang warning.
2017-03-04 21:40:07 +03:00
Mike Gelfand
16b78ef57c Prefix the rest of symbols with CTEST_IMPL_ and ctest_ for symmetry 2017-03-04 21:18:44 +03:00
Mike Gelfand
8e2f92d666 Don't use names starting with two underscores
Instead use CTEST_IMPL_ prefix for internal macros.

This eliminates "macro name is a reserved identifier [-Wreserved-id-macro]"
Clang warning.
2017-03-04 21:02:16 +03:00
Bas van den Berg
ae3a381d28 added ASSERT_INTERVAL to test for intervals 2016-02-22 15:43:03 +01:00
Bas van den Berg
7a78010830 updated copyright for 2016 2016-02-22 15:39:34 +01:00
Mike Gelfand
7a7bc6caed Fix "'...' was marked unused but was used" warnings
For that, declare test data structs static and use "used" attribute which
is more appropriate in this case instead of "unused" attribute.

Make use of `__TNAME()` macro instead of explicitly concatenating suite and
test name in two places where above warning was issued along the way.
2016-01-09 14:13:48 +03:00
Bas van den Berg
58dd9bf9d2 Readme: hint type on code fragments 2016-01-07 22:37:39 +01:00
Bas van den Berg
a66d37d10b describe features in Readme, remove from Makefile 2016-01-07 22:36:21 +01:00
Mike Gelfand
97289c76ab Pass const char* where mutability is not required 2016-01-06 20:42:10 +01:00
Bas van den Berg
bafa19e686 changed COLOR_OK -> CTEST_COLOR_OK to make it same as other features 2016-01-06 20:38:12 +01:00
Mike Gelfand
586b6bc056 Use proper types and format specifiers with *printf
Use `intmax_t` and `uintmax_t` for signed/unsigned integer assertions.
Previously used `size_t` isn't good enough as we could have 32-bit system
and still be able to work with 64-bit numbers.

Include `<stddef.h>` instead of `<stdio.h>` (which is included under
`CTEST_MAIN` ifdef anyway) to get `size_t` definition.

Use `PRI*` macros instead of `%llu` which may not be supported on some
systems.

Fix a couple of incorrect formatting instances, e.g. when `%d` was used
for line number output, and line number was being (mistakenly? looks like
copy-paste leftovers) casted to `long long` and `unsigned long long`.
2016-01-06 15:29:01 +03:00
Bas van den Berg
c0e79d4189 fix TearDown cast 2015-11-30 20:36:36 +01:00
Christian Wressnegger
447d03f49e explicitly cast the output of find_symbol function 2015-11-30 15:11:35 +01:00
Bas van den Berg
097d3ede68 CTEST_USE_COLORS -> CTEST_NO_COLORS (default on, users can disable) 2015-11-23 20:11:02 +01:00
Christian Wressnegger
dfb8d97ab4 CTEST_USECOLORS -> CTEST_USE_COLORS 2015-11-23 20:05:46 +01:00
Christian Wressnegger
e5e75b649e maintain a defintion (CTEST_USECOLORS) for the use of colors 2015-11-23 20:05:46 +01:00
Christian Wressnegger
5a49d09a7c make use of the new ASSERT_*_U functions in "test_large_numbers" test 2015-11-23 19:57:07 +01:00
Christian Wressnegger
1baa829a02 differentiate beetween signed and unsigned comparisons 2015-11-23 19:57:07 +01:00
Christian Wressnegger
cb64b0beb9 int might not be large enough to correctly represent the buffer's size 2015-11-23 19:57:07 +01:00
Yury Melnichek
69bdd083ac Fix unused parameter warning. 2015-11-23 14:21:47 +03:00
Bas van den Berg
9c8a166416 style changes 2015-11-14 23:20:43 +01:00
Christian Wressnegger
e01e09d71e explicit time conversion within getCurrentTime function 2015-11-14 23:16:57 +01:00