Opened 10 years ago

Closed 10 years ago

#2815 closed defect (fixed)

Compiling r7600 with Clang produces warnings

Reported by: tanaseiv Owned by:
Priority: trivial Component: General
Severity: low Keywords: oscam, oscam-string
Cc: Sensitive: no

Description

Revision

7600

Issue Description

Compiling revision 7600 with clang produces the following warnings:

oscam-string.c:13:47: warning: invalid conversion specifier 'Z' [-Wformat-invalid-specifier]

fprintf(stderr, "%s: ERROR: Can't allocate %Zd bytes!", func, size);

~

oscam-string.c:30:47: warning: invalid conversion specifier 'Z' [-Wformat-invalid-specifier]

fprintf(stderr, "%s: ERROR: Can't allocate %Zd bytes!", func, size);

When the issue occurs

when compiling the oscam with CC=clang

How the issue is reproducable

make CC=clang

$make CC=clang
+-------------------------------------------------------------------------------
| OSCam ver: 1.20-unstable_svn rev: 7600 target: i386-pc-linux-gnu
| Tools:
|  CROSS    = 
|  CC       = clang
|  STRIP    = strip
| Settings:
|  CONF_DIR = /usr/local/etc
|  CC_OPTS  = -O2 -ggdb -ffunction-sections -fdata-sections
|  CC_WARN  = -W -Wall -Wredundant-decls -Wstrict-prototypes -Wold-style-definition
|  CFLAGS   = 
|  LDFLAGS  = -Wl,--gc-sections
|  LIBS     = -lpthread -ldl
| Config:
|  Addons   : WEBIF CS_ANTICASC WITH_DEBUG CS_CACHEEX
|  Protocols: NEWCAMD CCCAM CONSTCW
|  Readers  : 
|  Compiler : Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
|  Linker   : GNU ld (GNU Binutils for Ubuntu) 2.22
|  Binary   : Distribution/oscam-1.20-unstable_svn7600-i386-pc-linux-gnu
+-------------------------------------------------------------------------------
CC	cscrypt/aes.c
CC	cscrypt/crc32.c
CC	cscrypt/des.c
CC	cscrypt/i_cbc.c
CC	cscrypt/i_ecb.c
CC	cscrypt/i_skey.c
CC	cscrypt/md5.c
CC	cscrypt/rc6.c
CC	cscrypt/sha1.c
CC	module-anticasc.c
CC	module-cacheex.c
CC	module-cccam.c
CC	module-cccshare.c
CC	module-constcw.c
CC	module-csp.c
CC	module-newcamd.c
CC	module-webif.c
CC	module-webif-lib.c
CC	module-webif-pages.c
CC	oscam-aes.c
CC	oscam-chk.c
CC	oscam-client.c
CC	oscam-conf.c
CC	oscam-conf-chk.c
CC	oscam-conf-mk.c
CC	oscam-config-account.c
CC	oscam-config-global.c
CC	oscam-config-reader.c
CC	oscam-config.c
CC	oscam-failban.c
CC	oscam-files.c
CC	oscam-garbage.c
CC	oscam-lock.c
CC	oscam-log.c
CC	oscam-net.c
CC	oscam-llist.c
CC	oscam-reader.c
CC	oscam-simples.c
CC	oscam-string.c
oscam-string.c:13:47: warning: invalid conversion specifier 'Z' [-Wformat-invalid-specifier]
                fprintf(stderr, "%s: ERROR: Can't allocate %Zd bytes!", __func__, size);
                                                           ~^
oscam-string.c:30:47: warning: invalid conversion specifier 'Z' [-Wformat-invalid-specifier]
                fprintf(stderr, "%s: ERROR: Can't allocate %Zd bytes!", __func__, size);
                                                           ~^
2 warnings generated.
CC	oscam.c
LINK	Distribution/oscam-1.20-unstable_svn7600-i386-pc-linux-gnu.debug
STRIP	Distribution/oscam-1.20-unstable_svn7600-i386-pc-linux-gnu

Change History (3)

comment:1 by tanaseiv, 10 years ago

Changing %Zd to %zd seems to fix the warning.

From:
fprintf(stderr, "%s: ERROR: Can't allocate %Zd bytes!", func, size);

To:
fprintf(stderr, "%s: ERROR: Can't allocate %zd bytes!", func, size);

comment:2 by gf, 10 years ago

Right, gcc accepts them both. I'll change it. Thanks.

comment:3 by gf, 10 years ago

Resolution: fixed
Status: newclosed

Fix commited in committed r7605. I usually test compilations with clang 2 and clang 3 as well as gcc but this time I forgot. I'll make a note.

Note: See TracTickets for help on using tickets.