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

Fix warning message in function pg_decode_commit_txn:297 #5

Closed
wants to merge 1 commit into from
Closed

Fix warning message in function pg_decode_commit_txn:297 #5

wants to merge 1 commit into from

Conversation

fabriziomello
Copy link

Fix warning message in function pg_decode_commit_txn:297

n# make USE_PGXS=1
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -fpic -I. -I./ -I/usr/include/postgresql/9.4/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o wal2json.o wal2json.c
wal2json.c: In function ‘pg_decode_commit_txn’:
wal2json.c:297:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘uint64’ [-Wformat=]
elog(DEBUG1, "my change counter: %d ; # of changes: %d ; # of changes in memory: %d", data->nr_changes, txn->nentries, txn->nentries_mem);
^
wal2json.c:297:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘uint64’ [-Wformat=]
wal2json.c:297:2: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘uint64’ [-Wformat=]
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -fpic -L/usr/lib/i386-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5 -L/usr/lib/i386-linux-gnu/mit-krb5 -Wl,--as-needed -shared -o wal2json.so wal2json.o

@eulerto
Copy link
Owner

eulerto commented Sep 26, 2015

I didn't reproduce your warning in my compiler. What compiler version are you using?

$ USE_PGXS=1 PATH=/home/euler/pg944/bin:$PATH make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fpic -I. -I./ -I/home/euler/pg944/include/postgresql/server -I/home/euler/pg944/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2 -c -o wal2json.o wal2json.c
wal2json.c: In function ‘pg_decode_commit_txn’:
wal2json.c:297:2: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64’ [-Wformat=]
elog(DEBUG1, "my change counter: %llu ; # of changes: %llu ; # of changes in memory: %llu", data->nr_changes, txn->nentries, txn->nentries_mem);
^
wal2json.c:297:2: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 4 has type ‘uint64’ [-Wformat=]
wal2json.c:297:2: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘uint64’ [-Wformat=]
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O2 -fpic -L/home/euler/pg944/lib -Wl,--as-needed -Wl,-rpath,'/home/euler/pg944/lib',--enable-new-dtags -shared -o wal2json.so wal2json.o
$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ uname -a
Linux vostro 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux

Also, is %lld portable? IMO a cast in better than %lld, no?

@eulerto
Copy link
Owner

eulerto commented Sep 26, 2015

Forgot to mention... are you using the last version? I'm not using %d in that message.

@fabriziomello
Copy link
Author

I'm using gcc 4.8.4 in Ubuntu 14.04. See the messages:

root@dbVDesenv:/usr/local/src/wal2json# make
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -fpic -I. -I./ -I/usr/include/postgresql/9.4/server -I/usr/include/postgresql/internal -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -I/usr/include/libxml2 -I/usr/include/tcl8.6 -c -o wal2json.o wal2json.c
wal2json.c: In function ‘pg_decode_commit_txn’:
wal2json.c:297:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘uint64’ [-Wformat=]
elog(DEBUG1, "my change counter: %lu ; # of changes: %lu ; # of changes in memory: %lu", data->nr_changes, txn->nentries, txn->nentries_mem);
^
wal2json.c:297:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64’ [-Wformat=]
wal2json.c:297:2: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘uint64’ [-Wformat=]
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -fpic -L/usr/lib/i386-linux-gnu -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -L/usr/lib/mit-krb5 -L/usr/lib/i386-linux-gnu/mit-krb5 -Wl,--as-needed -shared -o wal2json.so wal2json.o
root@dbVDesenv:/usr/local/src/wal2json#
root@dbVDesenv:/usr/local/src/wal2json#
root@dbVDesenv:/usr/local/src/wal2json# gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@eulerto eulerto closed this May 10, 2017
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

Successfully merging this pull request may close these issues.

2 participants