argtable / argtable3

A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options.
http://www.argtable.org
Other
377 stars 65 forks source link

Include "err.h" to be able to use `warnx()` #3

Closed vincentbernat closed 9 years ago

vincentbernat commented 9 years ago

Otherwise, we get a warning about warnx() not being defined.

vincentbernat commented 9 years ago

More generally, there are a lot of other warnings:

../../src/argtable3/argtable3.c:2839:9: warning: variable 'errorcode' set but not used [-Wunused-but-set-variable]
     int errorcode, i;
../../src/argtable3/argtable3.c: In function 'trex_element':
../../src/argtable3/argtable3.c:3183:7: warning: variable 'op' set but not used [-Wunused-but-set-variable]
   int op;
       ^
../../src/argtable3/argtable3.c: In function 'trex_matchnode':
../../src/argtable3/argtable3.c:3419:23: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(str == exp->_bol && !isspace(*str)
                       ^
../../src/argtable3/argtable3.c:3433:3: warning: value computed is not used [-Wunused-value]
   *str++;
   ^
../../src/argtable3/argtable3.c:3439:4: warning: value computed is not used [-Wunused-value]
    *str++;
    ^
../../src/argtable3/argtable3.c:3445:4: warning: value computed is not used [-Wunused-value]
    *str++;
    ^
../../src/argtable3/argtable3.c:3458:3: warning: value computed is not used [-Wunused-value]
   *str++;
   ^
../../src/argtable3/argtable3.c: In function 'trex_searchrange':
../../src/argtable3/argtable3.c:3549:3: warning: value computed is not used [-Wunused-value]
   *text_begin++;
   ^
../../src/argtable3/argtable3.c: At top level:
../../src/argtable3/argtable3.c:3842:6: warning: 'dump_longoptions' defined but not used [-Wunused-function]
 void dump_longoptions(struct longoptions * longoptions)
      ^
vincentbernat commented 9 years ago

The warnings about *str++ are here because *str++ is *(str++) which doesn't seem right. So it should be (*str)++ but that doesn't seem right either (why would we do that). I suppose this should str++.

vincentbernat commented 9 years ago

I'll do a global pull requests with proposed fixes.

vincentbernat commented 9 years ago

Well, the other pull request didn't include the fix for warnx(). So, let's reopen this one.