On Thu, Sep 18, 2014 at 3:08 PM, Peter Hutterer <peter.hutte...@who-t.net> wrote: > On Wed, Sep 17, 2014 at 07:11:35PM -0700, Jason Gerecke wrote: >> ../src/wcmConfig.c:701:16: warning: no previous extern declaration for >> non-static variable 'WACOM' [-Wmissing-variable-declarations] >> InputDriverRec WACOM = >> ^ >> ../src/wcmXCommand.c:82:6: warning: no previous extern declaration for >> non-static variable 'prop_devnode' [-Wmissing-variable-declarations] >> Atom prop_devnode; >> ^ >> ../src/wcmXCommand.c:83:6: warning: no previous extern declaration for >> non-static variable 'prop_rotation' [-Wmissing-variable-declarations] >> Atom prop_rotation; >> ^ >> ../src/wcmXCommand.c:84:6: warning: no previous extern declaration for >> non-static variable 'prop_tablet_area' [-Wmissing-variable-declarati$ >> Atom prop_tablet_area; >> ^ >> ../src/wcmXCommand.c:85:6: warning: no previous extern declaration for >> non-static variable 'prop_pressurecurve' [-Wmissing-variable-declara$ >> Atom prop_pressurecurve; >> ^ >> ../src/wcmXCommand.c:86:6: warning: no previous extern declaration for >> non-static variable 'prop_serials' [-Wmissing-variable-declarations] >> Atom prop_serials; >> ^ >> ../src/wcmXCommand.c:87:6: warning: no previous extern declaration for >> non-static variable 'prop_serial_binding' [-Wmissing-variable-declar$ >> Atom prop_serial_binding; >> ^ >> ../src/wcmXCommand.c:88:6: warning: no previous extern declaration for >> non-static variable 'prop_strip_buttons' [-Wmissing-variable-declara$ >> Atom prop_strip_buttons; >> ^ >> ../src/wcmXCommand.c:89:6: warning: no previous extern declaration for >> non-static variable 'prop_wheel_buttons' [-Wmissing-variable-declara$ >> Atom prop_wheel_buttons; >> ^ >> ../src/wcmXCommand.c:90:6: warning: no previous extern declaration for >> non-static variable 'prop_tv_resolutions' [-Wmissing-variable-declar$ >> Atom prop_tv_resolutions; >> ^ >> ../src/wcmXCommand.c:91:6: warning: no previous extern declaration for >> non-static variable 'prop_cursorprox' [-Wmissing-variable-declaratio$ >> Atom prop_cursorprox; >> ^ >> ../src/wcmXCommand.c:92:6: warning: no previous extern declaration for >> non-static variable 'prop_threshold' [-Wmissing-variable-declaration$ >> Atom prop_threshold; >> ^ >> ../src/wcmXCommand.c:93:6: warning: no previous extern declaration for >> non-static variable 'prop_suppress' [-Wmissing-variable-declarations] >> Atom prop_suppress; >> ^ >> ../src/wcmXCommand.c:94:6: warning: no previous extern declaration for >> non-static variable 'prop_touch' [-Wmissing-variable-declarations] >> Atom prop_touch; >> ^ >> ../src/wcmXCommand.c:98:6: warning: no previous extern declaration for >> non-static variable 'prop_hover' [-Wmissing-variable-declarations] >> Atom prop_hover; >> ^ >> ../src/wcmXCommand.c:99:6: warning: no previous extern declaration for >> non-static variable 'prop_tooltype' [-Wmissing-variable-declarations] >> Atom prop_tooltype; >> ^ >> ../src/wcmXCommand.c:100:6: warning: no previous extern declaration for >> non-static variable 'prop_btnactions' [-Wmissing-variable-declarati$ >> Atom prop_btnactions; >> ^ >> ../src/wcmXCommand.c:101:6: warning: no previous extern declaration for >> non-static variable 'prop_product_id' [-Wmissing-variable-declarati$ >> Atom prop_product_id; >> ^ >> ../src/wcmXCommand.c:102:6: warning: no previous extern declaration for >> non-static variable 'prop_pressure_recal' [-Wmissing-variable-decla$ >> Atom prop_pressure_recal; >> ^ >> ../src/wcmXCommand.c:104:6: warning: no previous extern declaration for >> non-static variable 'prop_debuglevels' [-Wmissing-variable-declarat$ >> Atom prop_debuglevels; >> ^ >> ../src/wcmXCommand.c:95:6: warning: no previous extern declaration for >> non-static variable 'prop_hardware_touch' [-Wmissing-variable-declar$ >> Atom prop_hardware_touch; >> ^ >> ../src/wcmXCommand.c:96:6: warning: no previous extern declaration for >> non-static variable 'prop_gesture' [-Wmissing-variable-declarations] >> Atom prop_gesture; >> ^ >> ../src/wcmXCommand.c:97:6: warning: no previous extern declaration for >> non-static variable 'prop_gesture_param' [-Wmissing-variable-declara$ >> Atom prop_gesture_param; >> ^ >> xsetwacom.c:476:3: warning: no previous extern declaration for non-static >> variable 'deprecated_parameters' [-Wmissing-variable-declarations] >> } deprecated_parameters[] = >> ^ >> xsetwacom.c:953:3: warning: no previous extern declaration for non-static >> variable 'keywords' [-Wmissing-variable-declarations] >> } keywords[] = { >> ^ >> isdv4-serial-debugger.c:44:5: warning: no previous extern declaration for >> non-static variable 'verbose' [-Wmissing-variable-declarations] >> int verbose = 0; >> ^ >> isdv4-serial-inputattach.c:41:5: warning: no previous extern declaration for >> non-static variable 'verbose' [-Wmissing-variable-declarations] >> int verbose; >> ^ >> >> Signed-off-by: Jason Gerecke <killert...@gmail.com> >> --- >> src/wcmConfig.c | 2 +- >> src/wcmXCommand.c | 44 >> ++++++++++++++++++++-------------------- >> tools/isdv4-serial-debugger.c | 1 + >> tools/isdv4-serial-inputattach.c | 3 ++- >> tools/xsetwacom.c | 4 ++-- >> 5 files changed, 28 insertions(+), 26 deletions(-) >> >> diff --git a/src/wcmConfig.c b/src/wcmConfig.c >> index 138a769..4872603 100644 >> --- a/src/wcmConfig.c >> +++ b/src/wcmConfig.c >> @@ -695,7 +695,7 @@ SetupProc_fail: >> return BadMatch; >> } >> >> -InputDriverRec WACOM = >> +static InputDriverRec WACOM = >> { >> 1, /* driver version */ >> "wacom", /* driver name */ >> diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c >> index 43ca6b3..2fae571 100644 >> --- a/src/wcmXCommand.c >> +++ b/src/wcmXCommand.c >> @@ -79,29 +79,29 @@ int wcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, >> int mode) >> return wcmDevSwitchModeCall(pInfo, mode); >> } >> >> -Atom prop_devnode; >> -Atom prop_rotation; >> -Atom prop_tablet_area; >> -Atom prop_pressurecurve; >> -Atom prop_serials; >> -Atom prop_serial_binding; >> -Atom prop_strip_buttons; >> -Atom prop_wheel_buttons; >> -Atom prop_tv_resolutions; >> -Atom prop_cursorprox; >> -Atom prop_threshold; >> -Atom prop_suppress; >> -Atom prop_touch; >> -Atom prop_hardware_touch; >> -Atom prop_gesture; >> -Atom prop_gesture_param; >> -Atom prop_hover; >> -Atom prop_tooltype; >> -Atom prop_btnactions; >> -Atom prop_product_id; >> -Atom prop_pressure_recal; >> +static Atom prop_devnode; >> +static Atom prop_rotation; >> +static Atom prop_tablet_area; >> +static Atom prop_pressurecurve; >> +static Atom prop_serials; >> +static Atom prop_serial_binding; >> +static Atom prop_strip_buttons; >> +static Atom prop_wheel_buttons; >> +static Atom prop_tv_resolutions; >> +static Atom prop_cursorprox; >> +static Atom prop_threshold; >> +static Atom prop_suppress; >> +static Atom prop_touch; >> +static Atom prop_hardware_touch; >> +static Atom prop_gesture; >> +static Atom prop_gesture_param; >> +static Atom prop_hover; >> +static Atom prop_tooltype; >> +static Atom prop_btnactions; >> +static Atom prop_product_id; >> +static Atom prop_pressure_recal; >> #ifdef DEBUG >> -Atom prop_debuglevels; >> +static Atom prop_debuglevels; >> #endif >> >> /** >> diff --git a/tools/isdv4-serial-debugger.c b/tools/isdv4-serial-debugger.c >> index 6629cb6..03abd26 100644 >> --- a/tools/isdv4-serial-debugger.c >> +++ b/tools/isdv4-serial-debugger.c >> @@ -40,6 +40,7 @@ >> >> #include "tools-shared.h" >> >> +extern int verbose; >> int verbose = 0; >> >> static void usage(void) >> diff --git a/tools/isdv4-serial-inputattach.c >> b/tools/isdv4-serial-inputattach.c >> index fedfce4..6003d30 100644 >> --- a/tools/isdv4-serial-inputattach.c >> +++ b/tools/isdv4-serial-inputattach.c >> @@ -37,7 +37,8 @@ >> >> #include "tools-shared.h" >> >> -int verbose; >> +extern int verbose; >> +int verbose = 0; > > that doesn't look right. > > Acked-by: Peter Hutterer <peter.hutte...@who-t.net> > for the series otherwise > > > Cheers, > Peter >
Can you go into a bit more detail? From what I understand, the language already guarantees that a file-scope variable is visible extern and initialized to zero. The code relies on that behavior as well, as its referenced by tools-shared.c and is expected to be zero by default. Really, this and the similar hunk for isdv4-serial-debug.c are just to shut up to checker (which I'm aware isn't always a sane idea, but seemed fine in this instance). Jason --- Now instead of four in the eights place / you’ve got three, ‘Cause you added one / (That is to say, eight) to the two, / But you can’t take seven from three, / So you look at the sixty-fours.... >> static void usage(void) >> { >> diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c >> index 31b682e..47c8791 100644 >> --- a/tools/xsetwacom.c >> +++ b/tools/xsetwacom.c >> @@ -468,7 +468,7 @@ static param_t parameters[] = >> /** >> * Deprecated parameters and their respective replacements. >> */ >> -struct deprecated >> +static struct deprecated >> { >> const char *name; >> const char *replacement; >> @@ -946,7 +946,7 @@ static int special_map_modetoggle(Display *dpy, int >> argc, char **argv, unsigned >> static int special_map_displaytoggle(Display *dpy, int argc, char **argv, >> unsigned long *ndata, unsigned long *data, const size_t size); >> >> /* Valid keywords for the --set ButtonX options */ >> -struct keywords { >> +static struct keywords { >> const char *keyword; >> int (*func)(Display*, int, char **, unsigned long*, unsigned long *, >> const size_t size); >> } keywords[] = { >> -- >> 2.1.0 >> >> >> ------------------------------------------------------------------------------ >> Want excitement? >> Manually upgrade your production database. >> When you want reliability, choose Perforce >> Perforce version control. Predictably reliable. >> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk >> _______________________________________________ >> Linuxwacom-devel mailing list >> Linuxwacom-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel >> ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that Matters. http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk _______________________________________________ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel