bugGNU Gengetopt - Bugs: bug #40243, please fix...

 
 

bug #40243: please fix -Wunused-but-set-variable warnings in generated code

Submitter:  Török Edwin <edwintorok>
Submitted:  Fri 11 Oct 2013 04:28:39 PM UTC
Votes: 100
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  gray_wolf Originator Name: 
Open/Closed:  Closed
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Sun 27 Jan 2019 11:05:08 PM UTC, comment #2: 

I was just hit by this today


src/cmdline.c: In function ‘update_arg’:
src/cmdline.c:453:9: warning: variable ‘stop_char’ set but not used [-Wunused-but-set-variable]
   char *stop_char = 0;
         ^~~~~~~~~


is there anything I can do to help move this bug along to get it fixed?

Tomas Volf <gray_wolf>
Group administrator
Thu 20 Nov 2014 11:14:21 AM UTC, comment #1: 

I propose attached patch to fix this compilation warnings.

I've fixed these three warnings but probably more warnings could be produced with other kind of parameters.



(file #32485)

Jose Luis Guardiola <jlguardi>
Fri 11 Oct 2013 04:28:39 PM UTC, original submission:  

Testcase:
$ cat >warningtest.ggo <<EOF
package "warningtest"
purpose "Should get not warnings with -Wall"
args "--unamed-opts --no-handle-version --strict-hidden"
usage "warningtest [OPTIONS]"

option "verbose"    v "Enable verbose messages" flag off
EOF

$ gengetopt <warningtest.ggo && gcc -c cmdline.c -DVERSION=\"test\" -Wall
cmdline.c: In function ‘update_arg’:
cmdline.c:335:15: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]
   const char *val = value;
               ^
cmdline.c:334:9: warning: variable ‘stop_char’ set but not used [-Wunused-but-set-variable]
   char *stop_char = 0;
         ^
cmdline.c: In function ‘cmdline_parser_internal’:
cmdline.c:408:7: warning: variable ‘check_required’ set but not used [-Wunused-but-set-variable]
   int check_required;
       ^

Török Edwin <edwintorok>

 

Attached Files

Attached Files
file #32485:  02unusedvariables.patch added by jlguardi (1.7KiB - text/x-diff - patch to fix unused variables warning)

(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 gray_wolf (Posted a comment)
  • -email is unavailable- added by superluigi (Voted in favor of this item)
  • -email is unavailable- added by jlguardi (Updated the item)
  • -email is unavailable- added by edwintorok (Submitted the item)
  • -email is unavailable- added by edwintorok
  •  

    Votes

    There are 100 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

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-05-18 gray_wolf StatusNone Fixed
        Assigned toNone gray_wolf
        Open/ClosedOpen Closed
    2016-11-05 superluigi Carbon-Copy- Added superluigi
    2014-11-20 jlguardi Attached File- Added 02unusedvariables.patch, #32485
    2013-10-11 edwintorok Carbon-Copy- Added edwintorok

    Back to the top

    Powered by Savane 3.16-2753.
    Corresponding source code