[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#8407) LMDB build warnings on Darwin/Clang for (s)printf



Full_Name: Joakim Hassila
Version: 
OS: Mac OS X 10.11
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (90.141.153.214)


Minor code style issue with latest https://github.com/LMDB/lmdb.

There are three (harmless) warnings that clang caught. Essentially it is the
same pattern for all three, usage of ternary operator yielding format strings
with different number of arguments, whereby the last one is ignored for one of
the format variants. 

To reproduce, just do "make" on a Mac with Xcode 7.3 installed (thus using clang
as the compiler).

+++++++++++++++
solid:liblmdb jocke$ make
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast
-Wuninitialized   -c mdb.c
mdb.c:10706:46: warning: data argument not used by format string
      [-Wformat-extra-args]
                                (int)mr[i].mr_pid, (size_t)mr[i].mr_tid,
txnid);
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
1 warning generated.
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast
-Wuninitialized   -c midl.c
ar rs liblmdb.a mdb.o midl.o
ar: creating archive liblmdb.a
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast
-Wuninitialized  -fPIC  -c mdb.c -o mdb.lo
mdb.c:10706:46: warning: data argument not used by format string
      [-Wformat-extra-args]
                                (int)mr[i].mr_pid, (size_t)mr[i].mr_tid,
txnid);
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
1 warning generated.
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast
-Wuninitialized  -fPIC  -c midl.c -o midl.lo
gcc  -pthread -shared -o liblmdb.so mdb.lo midl.lo 
clang: warning: argument unused during compilation: '-pthre%2'
gcc -pthread -O2 -g -W -Wall -Wno-unused-parameter -Wbad-function-cast
-Wuninitialized   -c mdb_stat.c
mdb_stat.c:206:12: warning: data argument not used by format string
      [-Wformat-extra-args]
                                                        pg, span);
                                                            ^
1 warning generated.
+++++++++++++++