Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compiler warnings #231

Merged
merged 1 commit into from
Jul 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions include/nomp-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,21 @@ int nomp_log_set_verbose(const int verbose);
int nomp_log_(const char *desc, int logno, nomp_log_type type,
const char *fname, unsigned line_no, ...);

#define nomp_log(logno, type, desc, ...) \
nomp_log_(desc, logno, type, __FILE__, __LINE__, ##__VA_ARGS__)
#define NOMP_CASE_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
#define NOMP_CASE(...) NOMP_CASE_IMPL(__VA_ARGS__, 2, 2, 2, 2, 2, 2, 2, 1, 0)

#define NOMP_FIRST_IMPL(first, ...) first
#define NOMP_FIRST(...) NOMP_FIRST_IMPL(__VA_ARGS__, throwaway)

#define NOMP_REST_IMPL_WITH_2(first, ...) , __VA_ARGS__
#define NOMP_REST_IMPL_WITH_1(first)
#define NOMP_REST_IMPL_(num, ...) NOMP_REST_IMPL_WITH_##num(__VA_ARGS__)
#define NOMP_REST_IMPL(num, ...) NOMP_REST_IMPL_(num, __VA_ARGS__)
#define NOMP_REST(...) NOMP_REST_IMPL(NOMP_CASE(__VA_ARGS__), __VA_ARGS__)

#define nomp_log(logno, type, ...) \
Ravindu-Hirimuthugoda marked this conversation as resolved.
Show resolved Hide resolved
nomp_log_(NOMP_FIRST(__VA_ARGS__), logno, type, __FILE__, \
__LINE__ NOMP_REST(__VA_ARGS__))

/**
* @ingroup nomp_log_utils
Expand Down
4 changes: 2 additions & 2 deletions tests/nomp-api-105.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// Calling nomp_jit() with valid functions should not return an error.
static int test_valid_clauses(void) {
int err = 0;
TEST_BUILTIN_TYPES(105_valid);
TEST_BUILTIN_TYPES(105_valid, );
return err;
}

// Calling nomp_jit() with invalid functions should return an error.
static int test_invalid_clauses(void) {
int err = 0;
TEST_BUILTIN_TYPES(105_invalid);
TEST_BUILTIN_TYPES(105_invalid, );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these , s are required now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TEST_BUILTIN_TYPES macro is not changed to TEST_BUILTIN_TYPES(...).

return err;
}

Expand Down
11 changes: 10 additions & 1 deletion tests/nomp-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,16 @@ inline static int subtest_(int err, const char *test_name) {
printf("\t%s: %s\033[0m\n", test_name, result);
return err;
}
#define SUBTEST(subtest, ...) subtest_(subtest(__VA_ARGS__), TOSTRING(subtest))
#define TEST_ARGS_CASE_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
#define TEST_ARGS_CASE(...) \
TEST_ARGS_CASE_IMPL(__VA_ARGS__, 2, 2, 2, 2, 2, 2, 2, 1, 0)

#define SUBTEST_IMPL_WITH_2(subtest, ...) \
subtest_(subtest(__VA_ARGS__), TOSTRING(subtest))
#define SUBTEST_IMPL_WITH_1(subtest) subtest_(subtest(), TOSTRING(subtest))
#define SUBTEST_IMPL_(num, ...) SUBTEST_IMPL_WITH_##num(__VA_ARGS__)
#define SUBTEST_IMPL(num, ...) SUBTEST_IMPL_(num, __VA_ARGS__)
#define SUBTEST(...) SUBTEST_IMPL(TEST_ARGS_CASE(__VA_ARGS__), __VA_ARGS__)

#define nomp_test_assert(cond) \
{ \
Expand Down