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

kArInfiniteTimeout warning #9

Open
flit opened this issue Sep 10, 2018 · 1 comment
Open

kArInfiniteTimeout warning #9

flit opened this issue Sep 10, 2018 · 1 comment

Comments

@flit
Copy link
Owner

flit commented Sep 10, 2018

(Issue reported by @diggit.)

There is one more warning:

./argon-rtos/include/argon/ar_kernel.h:54:26: warning: ISO C restricts enumerator values to range of 'int' [-Wpedantic]
     kArInfiniteTimeout = 0xffffffffUL   //!< Pass this value to wait forever to acquire a resource.

static const uint32_t kArInfiniteTimeout = 0xffffffffUL; would solve this warning, do/don't? (same would apply to kArNoTimeout for consistency

@flit
Copy link
Owner Author

flit commented Sep 10, 2018

The problem with using a static const for kArInfiniteTimeout and kArNoTimeout is that in C it would allocate storage (in .rodata) for these values. I'll look at this one and see if I can come up with something.

One option I've seen before is to cast the enum value to int, as in:

enum {
    kArInfiniteTimeout = (int)0xffffffffL,
};

But a quick test in Argon causes gcc 7.3.1 to report "comparison between signed and unsigned integer expressions" when comparing timeout parameters with this enum. So it needs more investigation.

Unfortunately, even moving to require C++11 or later wouldn't help here, since this is in the C API header ar_kernel.h.

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

No branches or pull requests

1 participant