Bug 14885

Summary: xorg/driver/xf86-video-nv - Compilation warning fixes
Product: xorg Reporter: Paulo César Pereira de Andrade <pcpa>
Component: Driver/nVidia (open)Assignee: Aaron Plattner <aplattner>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium Keywords: patch
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
0001-Compilation-warning-fixes.patch none

Description Paulo César Pereira de Andrade 2008-03-07 12:04:28 UTC
Created attachment 14925 [details] [review]
0001-Compilation-warning-fixes.patch

Added #ifndef/endif to some header files to allow multiple inclusion
(and the header files are clearly not intended for multiple inclusion, i.e.
redefining macros and including again).
  The only non static function declared in a source file now is
G80GetScrnInfoRec in g80_driver.c, as there isn't a clear header file to
declare it, and including nv_proto.h could define/declare more things then
is expected.
Comment 1 Aaron Plattner 2008-03-07 12:37:03 UTC
Thanks, Paulo.  What CFLAGS are you compiling with that produce these warnings?  The headers don't include each other and so shouldn't require guard #ifdefs.  If they're being included multiple times, then that's a bug but as far as I can tell they're fine.  I assume you're building with -Wmissing-prototypes.  You're right that several functions should have been marked static.  I'll fix those.
Comment 2 Paulo César Pereira de Andrade 2008-03-07 12:56:46 UTC
  I am using the "xorg-build.pl" script. It is a script I posted
some time ago in the xorg mailing list. I will try to post an updated
version soon.

  Basically, the script has a "debug" option that will set $ENV{CFLAGS}
to "-O0 -g3 -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -fno-strict-aliasing"

  But I am also using the patch #147145 to util/macros, that adds the
macros XORG_WARN_CFLAGS and XORG_CHECK_SYMBOLS. The first one has an
optional arguments to set WARN_CFLAGS, and runs AC_SUBST on it, and the
default value is the same the script uses with the debug option (but
doesn't add -O0 -g3).

  I added the #ifndef guard just as it is usually a good practice, but
the headers are simple enough and I believe other headers aren't
including them.
Comment 3 Aaron Plattner 2008-03-07 13:09:47 UTC
Okay.  I'm not going to worry about -Wmissing-prototypes unless it gets added to the default CFLAGS.  Marking fixed with commit f88ef390.

commit f88ef390985babdb2b489cf52bfa587e1879db38
Author: Aaron Plattner <aplattner@nvidia.com>
Date:   Fri Mar 7 12:32:40 2008 -0800

    Bug #14885: Add missing static keywords.

:100644 100644 0d72d9d... 404f178... M  src/g80_dac.c
:100644 100644 dda1c7f... 2e97e92... M  src/g80_display.c
:100644 100644 e151bb4... 84c5a5d... M  src/nv_driver.c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.