-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Linux fs.h causes compilation problems #376
Comments
IMO silently undefining a system macro would be far more confusing. I could add an |
The user's code won't compile either way, but I'd agree probably letting the user decide what to do would be the best bet. You don't have to be definitive, but pointing towards Indeed any clue that a rogue preprocessor macro is defined would be helpful. Other option is changing the queue traits var name, which is the best end result, but is a change for existing users who don't currently see any issues. |
Looks like I could use push_macro/pop_macro to avoid this for GCC and clang within the header itself. But it's not really improving anything, just hiding it. Also clang's implementation of push_macro appears buggy (warns about the original macro being unused after it's popped back). |
This implies it's present on msvc also: https://gcc.gnu.org/onlinedocs/gcc/Push_002fPop-Macro-Pragmas.html I guess the warning is because you didn't But yeah... that (if it works) only solves part of the problem, but not if the user has customised You could argue an |
/usr/include/linux/fs.h
does this:This definition of
BLOCK_SIZE
as a preprocessor constant causes subsequent use ofconcurrentqueue.h
orblockingconcurrentqueue.h
to not compile correctly, asBLOCK_SIZE
is used inmoodycamel::ConcurrentQueueDefaultTraits
.This is clearly a Linux / C issue, but it's not something that's likely to be fixable in
<linux/fs.h>
.My workaround was
#undef BLOCK_SIZE
before includingconcurrentqueue.h
. You might consider doing this by default in the header, as clearly a macro of that name is going to cause problems.Another option would be to
#error
and at least noisily warn the user of the problem - the compiler errors appear nonsensical and give no real clue what the problem is, so it took me a while to track this down. I wasn't even including<linux/fs.h>
, it was being transitively included byliburing.h
, which in turn was a dependency for Boost.ASIO'sBOOST_ASIO_HAS_IO_URING
mode. So while I suspected a#define
was to blame, it didn't actually appear in any source code or package dependencies.I guess the other option would be change the name of the variable you use, but that's a back-compat problem for your own users seeing as it's a customisation point.
The text was updated successfully, but these errors were encountered: