Bug 52155 - nv: build failure against older xserver API
Summary: nv: build failure against older xserver API
Alias: None
Product: xorg
Classification: Unclassified
Component: Driver/nVidia (open) (show other bugs)
Version: git
Hardware: All All
: medium normal
Assignee: Dave Airlie
QA Contact: Xorg Project Team
Depends on:
Reported: 2012-07-16 15:16 UTC by petr.salinger
Modified: 2012-07-17 20:19 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Description petr.salinger 2012-07-16 15:16:44 UTC
The compat-api.h glue uses as wrapper for older API

#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv

But the i is also used internally as variable for loop.
One "i" have to be renamed.

--- src/g80_driver.c
+++ src/g80_driver.c
@@ -749,7 +749,7 @@
     ScrnInfoPtr pScrn;
     G80Ptr pNv;
     CARD32 pitch;
-    int visualMask, i;
+    int visualMask;
     BoxRec AvailFBArea;

     /* First get the ScrnInfoRec */
@@ -810,7 +810,7 @@
     xf86InitFBManager(pScreen, &AvailFBArea);

     pNv->reg[0x00001708/4] = 0;
-    for(i = 0; i < 8; i++)
+    for(int i = 0; i < 8; i++)
         pNv->reg[0x00001900/4 + i] = 0;

     if(!pNv->NoAccel) {
Comment 1 Aaron Plattner 2012-07-16 20:24:46 UTC
I don't think C++-style loop declarations are allowed in X.Org's style guidelines, plus shadowing function arguments is generally bad.
Comment 2 petr.salinger 2012-07-17 05:43:43 UTC
It is possible to rename the other one (unused) in compat-api.h

#define SCREEN_INIT_ARGS_DECL int screenNum, ScreenPtr pScreen, int argc, char **argv

Or do proper renaming in g80_driver.c.
Comment 3 Aaron Plattner 2012-07-17 20:19:44 UTC
Looks like Dave lumped a fix for this into the change that bumped the version number:

commit 86e83109d6309455e505d636e7760942177b1519
Author: Dave Airlie <airlied@redhat.com>
Date:   Tue Jul 17 16:05:09 2012 +1000

    xf86-video-nv: bump to version 2.1.19
    Signed-off-by: Dave Airlie <airlied@redhat.com>

diff --git a/configure.ac b/configure.ac
index 05d34f9..e201b12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
 # Initialize Autoconf
-        [2.1.18],
+        [2.1.19],
diff --git a/src/compat-api.h b/src/compat-api.h
index 98ba435..0a87cf5 100644
--- a/src/compat-api.h
+++ b/src/compat-api.h
@@ -46,7 +46,7 @@
 #define SCREEN_ARG_TYPE int
 #define SCREEN_PTR(arg1) ScreenPtr pScreen = screenInfo.screens[(arg1)]
-#define SCREEN_INIT_ARGS_DECL int i, ScreenPtr pScreen, int argc, char **argv
+#define SCREEN_INIT_ARGS_DECL int scrnIndex, ScreenPtr pScreen, int argc, char **argv
 #define BLOCKHANDLER_ARGS_DECL int arg, pointer blockData, pointer pTimeout, pointer pReadmask
 #define BLOCKHANDLER_ARGS arg, blockData, pTimeout, pReadmask

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.