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

Address competition warnings fix in integer tests #182

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

BoskyWSMFN
Copy link

No description provided.

@BoskyWSMFN
Copy link
Author

I'll try to fix #102 later.

@mouse07410 mouse07410 merged commit 12b8e55 into mouse07410:vlm_master Mar 25, 2024
1 check passed
@mouse07410
Copy link
Owner

First, thank you!

Second - it looks like my Xcode toolchain now sees a different (albeit similar ;) problem:

  CC       check-INTEGER.o
check-INTEGER.c:175:3: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
                rint64, ret, check_i64, check_ret);
                ^~~~~~
check-INTEGER.c:175:16: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
                rint64, ret, check_i64, check_ret);
                             ^~~~~~~~~
check-INTEGER.c:177:44: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
        printf("%"ASN_PRIdMAX" %"ASN_PRIdMAX"\n", rint64, check_i64);
                ~~~~~~~~~~~~~                     ^~~~~~
check-INTEGER.c:177:52: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
        printf("%"ASN_PRIdMAX" %"ASN_PRIdMAX"\n", rint64, check_i64);
                               ~~~~~~~~~~~~~              ^~~~~~~~~
check-INTEGER.c:199:59: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'int64_t' (aka 'long long') [-Wformat]
        ret = snprintf(verify, sizeof(verify), "%"ASN_PRIdMAX"", check_i64);
                                                ~~~~~~~~~~~~~    ^~~~~~~~~
check-INTEGER.c:237:3: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                ruint64, ret, check_u64, check_ret);
                ^~~~~~~
check-INTEGER.c:237:17: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
                ruint64, ret, check_u64, check_ret);
                              ^~~~~~~~~
check-INTEGER.c:267:59: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
        ret = snprintf(verify, sizeof(verify), "%"ASN_PRIuMAX"", check_u64);
                                                ~~~~~~~~~~~~~    ^~~~~~~~~
8 warnings generated.

What do you think would be the consequences of re-defining those variables as intmax_t and uintmax_t correspondingly?

@BoskyWSMFN
Copy link
Author

I wouldn't do it for now.
Based on the code in GNU C /usr/include/stdint.h, intmax_t and uintmax_t have different sizes depending on __WORDSIZE. Using (u)intmax_t instead of (u)int64_t may have unforeseen consequences.
I'll come up with something else.

/* Largest integral types.  */
#if __WORDSIZE == 64
typedef long int                intmax_t;
typedef unsigned long int       uintmax_t;
#else
__extension__
typedef long long int           intmax_t;
__extension__
typedef unsigned long long int  uintmax_t;
#end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants