Skip to contentSkip to conversation

kms: Fix warning XNFprintf is deprecated

PATCH In review Sedat Dilek 4 participants 6 messages Feb 25, 2011 – Feb 26, 2011 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kms: Fix warning XNFprintf is deprecated

Noticed when building ati/radeon ddx against xserver 1.10-rc3.

[ build.log ]
../../src/radeon_kms.c:412:5: warning: 'XNFprintf' is deprecated (declared at /usr/include/xorg/os.h:273)

---
 src/radeon_kms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/radeon_kms.c +1 -1
index 158dc57..19b0c74 100644
@@ -409,7 +409,7 @@ static Bool radeon_open_drm_master(ScrnInfoPtr pScrn)
 	goto out;
     }
 
-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",
 		      dev->domain, dev->bus, dev->dev, dev->func);
 
     info->dri2.drm_fd = drmOpen("radeon", busid);
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 15 lines · Sedat Dilek

Noticed when building ati/radeon ddx against xserver 1.10-rc3.

[ build.log ]
../../src/radeon_kms.c:412:5: warning: 'XNFprintf' is deprecated (declared at /usr/include/xorg/os.h:273)

---
 src/radeon_kms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/radeon_kms.c +0 -0
index 158dc57..19b0c74 100644

src/radeon_kms.c static Bool radeon_open_drm_master(ScrnInfoPtr pScrn) · line 412

Quoted 5 lines
src/radeon_kms.c +1 -1
@@ -409,7 +409,7 @@ static Bool radeon_open_drm_master(ScrnInfoPtr pScrn)
 	goto out;
     }
 
-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",

A straight replacement like that, with no #ifdef's will break people building for Xorg 1.9 and older, since XNFasprintf is new in Xorg 1.10.

Signature · 2 lines
	-Alan Coopersmith-        [email protected]
	 Oracle Solaris Platform Engineering: X Window System
#2 lore raw
Quoted 5 lines · Alan Coopersmith

src/radeon_kms.c static Bool radeon_open_drm_master(ScrnInfoPtr pScrn) · line 412

Quoted 2 lines
src/radeon_kms.c +1 -1
-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",

A straight replacement like that, with no #ifdef's will break people building for Xorg 1.9 and older, since XNFasprintf is new in Xorg 1.10.

Oops, I failed to notice the other problem with this patch, which was reported in https://bugs.freedesktop.org/show_bug.cgi?id=34756 - the two API's are different - the replacement should be:

	XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
                    dev->domain, dev->bus, dev->dev, dev->func);

since it follows the style of the libc asprintf() function.

The compiler should have yelled loudly about the original patch when you tried building it, as Michel noted in his revert message.

Signature · 2 lines
	-Alan Coopersmith-        [email protected]
	 Oracle Solaris Platform Engineering: X Window System
#3 lore raw
Quoted 14 lines · Alan Coopersmith
Quoted 5 lines · Alan Coopersmith
Quoted 2 lines

-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",

A straight replacement like that, with no #ifdef's will break people building for Xorg 1.9 and older, since XNFasprintf is new in Xorg 1.10.

Oops, I failed to notice the other problem with this patch, which was reported in https://bugs.freedesktop.org/show_bug.cgi?id=34756 - the two API's are different - the replacement should be:

       XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus, dev->dev, dev->func);

Quoted 10 lines

since it follows the style of the libc asprintf() function.

The compiler should have yelled loudly about the original patch when you tried building it, as Michel noted in his revert message.

--
       -Alan Coopersmith-        [email protected] Oracle Solaris Platform Engineering: X Window System

[ CC [email protected] (Sorry, could not decrypt your real name) ]

A short hello from my bday party and sorry for the breakage.

I have gone through all replies and I have built and installed a new ddx against xserver-1.10-rc3 with a v2 of my initial patch (which I will send separately).

- Sedat -
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1298668038-16374-1-git-send-email-sedat.dilek-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#5 lore raw

Pushed a variant of this without breaking pre-1.10 xservers. cb4dc7ab66016d0c980800f8dbf71bbe993889d3

Quoted 31 lines · Sedat Dilek

Noticed when building ati/radeon ddx against xserver 1.10-rc3.

[ build.log ]
../../src/radeon_kms.c:412:5: warning: 'XNFprintf' is deprecated (declared at /usr/include/xorg/os.h:273)

---
 src/radeon_kms.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
src/radeon_kms.c +1 -2
index 158dc57..19b0c74 100644
@@ -409,7 +409,7 @@ static Bool radeon_open_drm_master(ScrnInfoPtr pScrn)
        goto out;
     }
 
-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",
                      dev->domain, dev->bus, dev->dev, dev->func);
 
     info->dri2.drm_fd = drmOpen("radeon", busid);
--

1.7.4.1

_______________________________________________
dri-devel mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw
In reply to Sedat Dilek

[Dropping dri-devel from CC]

Quoted 15 lines · Sedat Dilek

Noticed when building ati/radeon ddx against xserver 1.10-rc3.

[ build.log ]
../../src/radeon_kms.c:412:5: warning: 'XNFprintf' is deprecated (declared at /usr/include/xorg/os.h:273)

---
 src/radeon_kms.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/radeon_kms.c +0 -0
index 158dc57..19b0c74 100644

src/radeon_kms.c static Bool radeon_open_drm_master(ScrnInfoPtr pScrn) · line 415

Quoted 8 lines
src/radeon_kms.c +1 -1
@@ -409,7 +409,7 @@ static Bool radeon_open_drm_master(ScrnInfoPtr pScrn)
 	goto out;
     }
 
-    busid = XNFprintf("pci:%04x:%02x:%02x.%d",
+    busid = XNFasprintf("pci:%04x:%02x:%02x.%d",
 		      dev->domain, dev->bus, dev->dev, dev->func);
 
     info->dri2.drm_fd = drmOpen("radeon", busid);

Did you test this patch at all? :(

cc1: warnings being treated as errors
../../src/radeon_kms.c: In function ‘radeon_open_drm_master’:
../../src/radeon_kms.c:413: error: passing argument 1 of ‘XNFasprintf’ from incompatible pointer type /usr/local/include/xorg/Xprintf.h:57: note: expected ‘char **’ but argument is of type ‘char *’ ../../src/radeon_kms.c:413: error: passing argument 2 of ‘XNFasprintf’ makes pointer from integer without a cast /usr/local/include/xorg/Xprintf.h:57: note: expected ‘const char * restrict’ but argument is of type ‘uint16_t’ ../../src/radeon_kms.c:413: error: assignment makes pointer from integer without a cast make[2]: *** [radeon_kms.lo] Error 1
make[2]: Leaving directory `/home/michdaen/src/xorg-git/driver/xf86-video-ati/build-ppc/src' make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/michdaen/src/xorg-git/driver/xf86-video-ati/build-ppc'
make: *** [all] Error 2
make: Leaving directory `/home/michdaen/src/xorg-git/driver/xf86-video-ati/build-ppc'

https://bugs.freedesktop.org/show_bug.cgi?id=34756 looks like it could be due to this.

I've reverted this for now, please only re-submit after fixing the above and preferably include a statement about the testing performed.

Signature · 6 lines
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel