Re: [nfs-utils PATCH 5/7] rpcgen: rpc_cout: fix potential -Wformat-nonliteral warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Steve,

you've missed this patch while applying the series. Can you please commit it?

Thank you
Kind regards
--
Giulio Benetti
Benetti Engineering sas

On 1/3/20 10:50 PM, Giulio Benetti wrote:
format and vecformat must be declared as "char * const" to be really
treated as constant when building with -Werror=format-nonliteral,
otherwise compiler will consider them subject to change throughout the
function.

Signed-off-by: Giulio Benetti <giulio.benetti@xxxxxxxxxxxxxxxxxxxxxx>
---
  tools/rpcgen/rpc_cout.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/rpcgen/rpc_cout.c b/tools/rpcgen/rpc_cout.c
index f806a86a..df2609c4 100644
--- a/tools/rpcgen/rpc_cout.c
+++ b/tools/rpcgen/rpc_cout.c
@@ -319,8 +319,8 @@ emit_union(definition *def)
    case_list *cl;
    declaration *cs;
    char *object;
-  char *vecformat = "objp->%s_u.%s";
-  char *format = "&objp->%s_u.%s";
+  char * const vecformat = "objp->%s_u.%s";
+  char * const format = "&objp->%s_u.%s";
print_stat(1,&def->def.un.enum_decl);
    f_print(fout, "\tswitch (objp->%s) {\n", def->def.un.enum_decl.name);





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux