Removed more warnings that now errors via -W
Subsystems (2)
cover Removed more warnings that now errors via -W
The patches remove more warnings that are errors via the -W flags. Basically allows RHEL7 to compile with following flags:
-Wformat=2 -Wmissing-include-dirs \
-Wunused -Wlogical-op \
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
-Wmissing-noreturn -Wshadow \
-Wunreachable-code -Wdisabled-optimization \
-fstrict-aliasing -fstrict-overflow \
-fexceptions -fstack-protector \
-fasynchronous-unwind-tables -fpie" \
There are still warnings but there are no more fatel errors.
Steve Dickson (4):
xtab.c: Removed overflow in implicit constant conversion errors Removed ISO C does not support the '%m' gnu_printf format errors Removed format expects argument of type errors gssd.c: Remomved a couple of warning errors
support/include/exportfs.h | 2 +- utils/gssd/gssd.c | 20 ++++++++++---------- utils/idmapd/idmapd.c | 3 ++- utils/nfsidmap/nfsidmap.c | 2 +- utils/nfsstat/nfsstat.c | 6 +++--- utils/statd/statd.c | 7 ++++--- 6 files changed, 21 insertions(+), 19 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/4 xtab.c: Removed overflow in implicit constant conversion errors
xtab.c: In function 'xtab_read':
xtab.c:60:4: error: overflow in implicit constant conversion [-Werror=overflow]
exp->m_xtabent = 1;
^
xtab.c:61:4: error: overflow in implicit constant conversion
[-Werror=overflow]
exp->m_mayexport = 1;--- support/include/exportfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
support/include/exportfs.h +1 -1
@@ -97,7 +97,7 @@ typedef struct mexport {struct mclient * m_client;struct exportent m_export;int m_exported;/* known to knfsd. */ - int m_xtabent : 1, /* xtab entry exists */ + unsigned int m_xtabent : 1, /* xtab entry exists */ m_mayexport: 1, /* derived from xtabbed */ m_changed : 1, /* options (may) have changed */ m_warned : 1; /* warned about multiple exports
Signature · 1 line
1.8.3.1
Re: [PATCH 1/4] xtab.c: Removed overflow in implicit constant conversion errors
Quoted 23 lines · Steve Dickson
=20
xtab.c: In function 'xtab_read':
xtab.c:60:4: error: overflow in implicit constant conversion [-Werror=3Doverflow]exp->m_xtabent =3D 1; ^xtab.c:61:4: error: overflow in implicit constant conversion [-Werror=3Doverflow]
exp->m_mayexport=3D 1;
=20Signed-off-by Steve Dickson <[email protected]>---
support/include/exportfs.h| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)=20
support/include/exportfs.h +0
-0
support/include/exportfs.h typedef struct mexport { · line 100
Quoted 5 lines
support/include/exportfs.h +1
-1@@ -97,7 +97,7 @@ typedef struct mexport {struct mclient * m_client;struct exportent m_export;int m_exported;/* known to knfsd. */ - int m_xtabent : 1, /* xtab entry exists */ + unsigned int m_xtabent : 1, /* xtab entry exists */
Nit: White space damage. "m_xtabent" and the colon should line up with = the following fields.
Overall these look like all the errors I hit. Thanks for the fixes!
support/include/exportfs.h typedef struct mexport { · line 101
Quoted 1 line
support/include/exportfs.h +0
-0m_mayexport: 1, /* derived from xtabbed =
*/
support/include/exportfs.h typedef struct mexport { · line 102
Quoted 1 line
support/include/exportfs.h +0
-0m_changed : 1, /* options (may) have =
changed */
support/include/exportfs.h typedef struct mexport { · line 103
Quoted 1 line
support/include/exportfs.h +0
-0m_warned :1 ;/* warned about multiple =
exports
Quoted 5 lines
--=20
1.8.3.1
=20
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
Quoted 2 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Chuck Lever
PATCH 2/4 Removed ISO C does not support the '%m' gnu_printf format errors
In reply to Steve Dicksonnfsstat.c: In function 'mounts':
nfsstat.c:1016:3: error: ISO C does not support the '%m' gnu_printf format [-Werror=format=]
fprintf(stderr, "Warning: %s: %m\n", name);
^nfsstat.c: In function 'get_stats':
nfsstat.c:1093:6: error: ISO C does not support the '%m' gnu_printf format [-Werror=format=]
label, file);
statd.c: In function 'set_nlm_port':
statd.c:235:5: error: ISO C does not support the '%m' gnu_printf format [-Werror=format=]
name_p, type);
^statd.c:238:3: error: ISO C does not support the '%m' gnu_printf format [-Werror=format=]
fprintf(stderr, "%s: failed to open %s: %m\n", name_p, pathbuf);
--- utils/nfsstat/nfsstat.c | 6 +++--- utils/statd/statd.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-)
utils/nfsstat/nfsstat.c +3 -3
@@ -1013,7 +1013,7 @@ mounts(const char *name)* be a fatal error -- it usually means the module isn't loaded. */ if ((fp =fopen (name,"r" )) ==NULL ) { -fprintf (stderr,"Warning: %s: %m\n" , name); +fprintf (stderr,"Warning: %s: %s\n" , name,strerror (errno));return 0 ; }
@@ -1089,8 +1089,8 @@ out:fclose (fp);if (err) {if (!other_opt) { -fprintf (stderr,"Error: No %s Stats (%s: %m). \n" , - label, file); +fprintf (stderr,"Error: No %s Stats (%s: %s). \n" , + label, file,strerror (errno));exit (2 ); } *opt =0 ;
utils/statd/statd.c +4 -3
@@ -231,11 +231,12 @@ static void set_nlm_port(char *type, int port) }if (fd >=0 ) {if (write (fd, nbuf,strlen (nbuf)) != (ssize_t )strlen (nbuf)) -fprintf (stderr,"%s: fail to set NLM %s port: %m\n" , - name_p, type); +fprintf (stderr,"%s: fail to set NLM %s port: %s\n" , + name_p, type,strerror (errno));close (fd); }else -fprintf (stderr,"%s: failed to open %s: %m\n" , name_p, pathbuf); +fprintf (stderr,"%s: failed to open %s: %s\n" , + name_p, pathbuf,strerror (errno)); }/*
Signature · 1 line
1.8.3.1
PATCH 3/4 Removed format expects argument of type errors
In reply to Steve Dicksonidmapd.c: In function 'getfield':
idmapd.c:936:4: error: format '%o' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Werror=format=]
if ((n = sscanf(bp, "\\%03o", &val)) != 1)
nfsidmap.c: In function 'key_invalidate':
nfsidmap.c:322:3: error: format '%x' expects argument of type 'unsigned int *', but argument 3 has type 'key_serial_t *' [-Werror=format=]
sscanf(buf, "%x", &key);
--- utils/idmapd/idmapd.c | 3 ++- utils/nfsidmap/nfsidmap.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
utils/idmapd/idmapd.c +2 -1
@@ -923,7 +923,8 @@ static int getfield(char **bpp, char *fld, size_t fldsz) {char *bp; -int val, n; +unsigned int val; +int n;while ((bp =strsep (bpp," " )) !=NULL && bp[0 ] =='\0' ) ;
utils/nfsidmap/nfsidmap.c +1 -1
@@ -283,7 +283,7 @@ static int key_invalidate(char *keystr, int keymask) {FILE *fp;char buf[BUFSIZ ], *ptr; -key_serial_t key; +unsigned int key;int mask;xlog_syslog (0 );
Signature · 1 line
1.8.3.1
PATCH 4/4 gssd.c: Remomved a couple of warning errors
In reply to Steve Dicksongssd.c:291:7: error: ISO C does not support the 'm' scanf flag [-Werror=format=]
gssd.c:291:7: error: format '%s' expects argument of type 'char *', but argument 4 has type 'char **' [-Werror=format=]
--- utils/gssd/gssd.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
utils/gssd/gssd.c +10 -10
@@ -279,16 +279,16 @@ gssd_read_service_info(int dirfd, struct clnt_info *clp)* (commit bf19aacecbeebccb2c3d150a8bd9416b7dba81fe) */ numfields =fscanf (info, -"RPC server: %ms\n" -"service: %ms (%d) version %d\n" -"address: %ms\n" -"protocol: %ms\n" -"port: %ms\n" , - &server, - &service, &program, &version, - &address, - &protoname, - &port); +"RPC server: %s\n" +"service: %s (%d) version %d\n" +"address: %s\n" +"protocol: %s\n" +"port: %s\n" , + (char *)&server, + (char *)&service, &program, &version, + (char *)&address, + (char *)&protoname, + (char *)&port);switch (numfields) {
Signature · 1 line
1.8.3.1
Quoted 21 lines · Steve Dickson
The patches remove more warnings that are errors via the -W flags. Basically allows RHEL7 to compile with following flags:
(quoted diff) +0
-8-Wformat=2 -Wmissing-include-dirs \ -Wunused -Wlogical-op \ -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \ -Wmissing-noreturn -Wshadow \ -Wunreachable-code -Wdisabled-optimization \ -fstrict-aliasing -fstrict-overflow \ -fexceptions -fstack-protector \ -fasynchronous-unwind-tables -fpie" \There are still warnings but there are no more fatel errors.
Steve Dickson (4):
xtab.c: Removed overflow in implicit constant conversion errors Removed ISO C does not support the '%m'gnu_printfformat errors Removed format expects argument of type errorsgssd.c: Remomved a couple of warning errors
Quoted 8 lines
support/include/exportfs.h | 2 +- utils/gssd/gssd.c | 20 ++++++++++---------- utils/idmapd/idmapd.c | 3 ++- utils/nfsidmap/nfsidmap.c | 2 +- utils/nfsstat/nfsstat.c | 6 +++--- utils/statd/statd.c | 7 ++++--- 6 files changed, 21 insertions(+), 19 deletions(-)
Committed... with the nit fixed.
steved.