Skip to content

Commit

Permalink
Merge pull request #225 from mikkoi/fix-c-standard-to-c99
Browse files Browse the repository at this point in the history
Fix c standard to c99
  • Loading branch information
brarcher authored Oct 25, 2019
2 parents 447e759 + a838e5d commit 5c6ba01
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT
include(GNUInstallDirs)

###############################################################################
# Adhere strictly to old ANSI C89 / ISO C90 standard
set(CMAKE_C_STANDARD 90)
# Follow ISO C99 standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS ON) # Use GNU extensions and POSIX standard

Expand Down
2 changes: 1 addition & 1 deletion src/check_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static size_t get_max_msg_size(void)
size_t value = 0;
char *env = getenv("CK_MAX_MSG_SIZE");
if (env)
value = (size_t)strtoul(env, NULL, 10); // Cast in case size_t != unsigned long.
value = (size_t)strtoul(env, NULL, 10); /* Cast in case size_t != unsigned long. */
if (value == 0)
value = ck_max_msg_size;
if (value == 0)
Expand Down
4 changes: 4 additions & 0 deletions src/check_run.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
#include <signal.h>
#include <setjmp.h>

#if defined(HAVE_FORK) && HAVE_FORK==1
# include <sys/wait.h>
#endif

#include "check.h"
#include "check_error.h"
#include "check_list.h"
Expand Down
4 changes: 2 additions & 2 deletions tests/check_check_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ char * line_num_failures_file_name = NULL;

enum ck_test_msg_type_t {
#if ENABLE_REGEX
// For tests with different output on different platforms
/* For tests with different output on different platforms */
CK_MSG_REGEXP,
#endif
// Simple text
/* Simple text */
CK_MSG_TEXT
};

Expand Down
6 changes: 3 additions & 3 deletions tests/check_check_sub.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ START_TEST(test_ck_assert_float_finite)
record_test_name(tcase_name());

ck_assert_float_finite(x);
// MS VS doesn't allow explicit division by zero
/* MS VS doesn't allow explicit division by zero */
x = 1.0f / (1.0f - t);
record_failure_line_num(__LINE__);
ck_assert_float_finite(x);
Expand Down Expand Up @@ -1452,7 +1452,7 @@ START_TEST(test_ck_assert_double_finite)
record_test_name(tcase_name());

ck_assert_double_finite(x);
// MS VS doesn't allow explicit division by zero
/* MS VS doesn't allow explicit division by zero */
x = 1.0 / (1.0 - t);
record_failure_line_num(__LINE__);
ck_assert_double_finite(x);
Expand Down Expand Up @@ -1970,7 +1970,7 @@ START_TEST(test_ck_assert_ldouble_finite)
record_test_name(tcase_name());

ck_assert_ldouble_finite(x);
// MS VS doesn't allow explicit division by zero
/* MS VS doesn't allow explicit division by zero */
x = 1.0l / (1.0l - t);
record_failure_line_num(__LINE__);
ck_assert_ldouble_finite(x);
Expand Down
4 changes: 2 additions & 2 deletions tests/check_set_max_msg_size.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ int main (int argc, char *argv[])
* Run the test suite. This is intended to trigger the "Message is too long" error.
* Actual success/failure is determined by examining the output.
*/
check_set_max_msg_size(32); // 1st call has no effect since
check_set_max_msg_size(atoi(argv[1])); // the 2nd call will override it.
check_set_max_msg_size(32); /* 1st call has no effect since */
check_set_max_msg_size(atoi(argv[1])); /* the 2nd call will override it. */
sr = srunner_create(make_set_max_msg_size_suite());
srunner_run_all(sr, CK_NORMAL);
srunner_free(sr);
Expand Down

0 comments on commit 5c6ba01

Please sign in to comment.