bugGNU Gengetopt - Bugs: bug #60194, When PACKAGE_NAME is the same as...

 
 

bug #60194: When PACKAGE_NAME is the same as PACKAGE, generated code gives a warning

Submitter:  Reuben Thomas <rrt>
Submitted:  Tue 09 Mar 2021 09:08:26 AM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 09 Mar 2021 09:08:26 AM UTC, original submission:  

I have a program whose PACKAGE and PACKAGE_NAME are the same; compiling cmdline.c gives:

cmdline.c: In function ‘cmdline_parser_print_version’:
cmdline.c:98:73: warning: this condition has identical branches [-Wduplicated-branches]
   98 |      (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
      |                                                                         ^
cmdline.c: In function ‘cmdline_parser_required’:
cmdline.c:321:1: warning: function might be candidate for attribute ‘const’ [-Wsuggest-attribute=const]
  321 | cmdline_parser_required (struct gengetopt_args_info *args_info, const char *prog_name)
      | ^~~~~~~~~~~~~~~~~~~~~~~

This is obviously a minor annoyance, but it would be nice to fix if it were easy, either by adding a GCC pragma to disable the warning (a little hacky), or by detecting this case and avoiding emitting the test (perhaps a bit harder?).

Reuben Thomas <rrt>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rrt (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-5884.
    Corresponding source code