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
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

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>

 

Attached Files

This item currently has no attached files.

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

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

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

    Votes

    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.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-a7ba.
    Corresponding source code