[CDRIVER-2428] importable use of macro Created: 13/Dec/17  Updated: 14/Dec/17  Resolved: 14/Dec/17

Status: Closed
Project: C Driver
Component/s: libbson
Affects Version/s: None
Fix Version/s: 1.8.0

Type: Bug Priority: Minor - P4
Reporter: Rainer Gerhards Assignee: A. Jesse Jiryu Davis
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Fedora 26 and others


Issue Links:
Duplicate
duplicates CDRIVER-2197 Add -Wexpansion-to-defined to maintai... Closed

 Description   

Hello,

we support MongoDB in rsyslog via plugins. It is our policy to do clean compiles at high warning level. Unfortunately, libbson seems to have some portability issues. This is part of the build log:

In file included from /usr/include/libbson-1.0/bson-compat.h:38:0,
from /usr/include/libbson-1.0/bson.h:23,
from /usr/include/libmongoc-1.0/mongoc.h:22,
from logctl.c:48:
/usr/include/libbson-1.0/bson-macros.h:185:33: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
#if BSON_GNUC_CHECK_VERSION(4, 0) && !defined(_WIN32)
^
/usr/include/libbson-1.0/bson-macros.h:205:35: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
#elif BSON_GNUC_CHECK_VERSION(4, 4)
^
/usr/include/libbson-1.0/bson-macros.h:235:33: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
#if BSON_GNUC_CHECK_VERSION(3, 1)
^
/usr/include/libbson-1.0/bson-macros.h:242:33: error: this use of "defined" may not be portable [-Werror=expansion-to-defined]
#if BSON_GNUC_CHECK_VERSION(4, 5)



 Comments   
Comment by A. Jesse Jiryu Davis [ 14/Dec/17 ]

Thanks for the info! Yes, now that I think of it, we detected and fixed this problem in CDRIVER-2197.

Comment by Rainer Gerhards [ 14/Dec/17 ]

I do not find a way to close this issue (maybe overlooking the obvious). Please close as invalid.

Comment by Rainer Gerhards [ 14/Dec/17 ]

sorry for the noise — it turns out that I used a too-old (packaged) version. After update to current stable, everything works.

Rainer

Comment by A. Jesse Jiryu Davis [ 14/Dec/17 ]

Using GCC 7.2.1 on Arch Linux I haven't been able to reproduce this:

> ./configure --enable-maintainer-flags
...
checking whether C compiler accepts -Wexpansion-to-defined... yes
...

I'm able to compile libmongoc there without warnings.

Comment by A. Jesse Jiryu Davis [ 13/Dec/17 ]

Thanks. We test that we libbson compiles without warnings in a couple GCC and Clang configurations. Could you tell us what compiler and flags you use please?

Generated at Wed Feb 07 21:15:11 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.