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

Add a New Comment Rich Markup
   

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?

Gray Wolf <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>

 

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

Attach Files:
   
   
Comment:
   

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

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
  •  

    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.

     

    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.13-d3ae.
    Corresponding source code