bug-gperf
[Top][All Lists]
Advanced

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

[bug #64393] -Wunused-parameter]


From: Vinícius dos Santos Oliveira
Subject: [bug #64393] -Wunused-parameter]
Date: Fri, 7 Jul 2023 22:35:33 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?64393>

                 Summary: -Wunused-parameter]
                   Group: gperf
               Submitter: vinipsmaker
               Submitted: Sat 08 Jul 2023 02:35:31 AM UTC
                Category: Generated code
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 08 Jul 2023 02:35:31 AM UTC By: Vinícius dos Santos Oliveira
<vinipsmaker>
I use gperf extensively across my codebase (e.g. 20 gperf invocations per
translation unit). For some of the functions, code such as the following is
generated:


gperf__src_unix_cpp_20::hash (const char *str, size_t len)
{
  return len;
}


When every input string differs in size, the size itself becomes the hash
function. So far so good, but the the argument `str` is unused and lots of
warnings per file are generated which pollutes my build output considerably:


libemilua.a.p/bc2_unix.cpp:3937:43: warning: unused parameter 'str'
[-Wunused-parameter]
gperf__src_unix_cpp_20::hash (const char *str, size_t len)
                                          ^
16 warnings generated.


All warnings from this single translation unit come from gperf (I stitch
multiple gperf invocations to a single translation unit using an AWK script,
but that's not important).

I don't know why, but sometimes `len` is the unused argument. Sample output:


gperf__src_unix_cpp_17::hash (const char *str, size_t len)
{
  return 0;
}


What I'd like to see is a standard header that is always included in the body
of the implementation for these functions:


(void)str;
(void)len;


This simple change will get rid of all warnings. I don't mind if the code
generation for this header is hidden behind some CLI flag. I just want to get
rid of the build warnings that distract me away from real issues in my
codebase.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?64393>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]