-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: libmongoc
-
None
I observed the following build warning when compiling libmongoc for PHPC:
In file included from phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c:31:0: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c: In function ‘mongoc_topology_rescan_srv’: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h:39:19: warning: too many arguments for format [-Wformat-extra-args] "TRACE: %s():%d " msg, \ ^ phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c:640:4: note: in expansion of macro ‘TRACE’ TRACE ("Polling for SRV records", NULL); ^~~~~ In file included from phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c:21:0: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c: In function ‘mongoc_topology_description_handle_ismaster’: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h:39:19: warning: too many arguments for format [-Wformat-extra-args] "TRACE: %s():%d " msg, \ ^ phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology-description.c:2001:10: note: in expansion of macro ‘TRACE’ TRACE ("wrong set name", NULL); ^~~~~
This appears to have been introduced in 370fc18 for CDRIVER-3625 and pertains to how TRACE is defined in mongoc-trace-private.h as a proxy to mongoc_log. The macro's msg argument is always expected but subsequent arguments are taken with .... Removing the NULL argument resulted in an outright error:
In file included from phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c:31:0: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c: In function ‘mongoc_topology_rescan_srv’: phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-trace-private.h:42:30: error: expected expression before ‘)’ token __VA_ARGS__); \ ^ phpc/src/libmongoc/src/libmongoc/src/mongoc/mongoc-topology.c:640:4: note: in expansion of macro ‘TRACE’ TRACE ("Polling for SRV records"); ^~~~~
If we can't fix this directly, perhaps it'd be best to simply suppress any -Wformat-extra-args warnings around the TRACE macro.
- is related to
-
CDRIVER-3625 Multi-threaded scanning should scan servers independently
- Closed
- related to
-
PHPC-1632 Reduce default keepalive time to align with Azure defaults
- Closed