Discussion:
[PATCH] va.h: fix compile warning
(too old to reply)
Li Zhijian
2016-11-21 10:17:32 UTC
Permalink
define the VAPrivFunc with parameter 'void'

va.h will be installed, and it will cause a compiling failure if someone
include this header to his code. So this change make the compiler happy.

Signed-off-by: Li Zhijian <***@intel.com>
---
va/va.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/va/va.h b/va/va.h
index 153a89b..8791906 100644
--- a/va/va.h
+++ b/va/va.h
@@ -291,7 +291,7 @@ const char *vaQueryVendorString (
VADisplay dpy
);

-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);

/**
* Return a function pointer given a function name in the library.
--
2.7.4
Xiang, Haihao
2016-11-21 15:25:15 UTC
Permalink
Although taking unspecified arguments is obsolete, I don't see any failure caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?

Thanks
Haihao
-----Original Message-----
Zhijian
Sent: Monday, November 21, 2016 6:18 PM
Subject: [Libva] [PATCH] va.h: fix compile warning
define the VAPrivFunc with parameter 'void'
va.h will be installed, and it will cause a compiling failure if someone include
this header to his code. So this change make the compiler happy.
---
va/va.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/va/va.h b/va/va.h
index 153a89b..8791906 100644
--- a/va/va.h
+++ b/va/va.h
@@ -291,7 +291,7 @@ const char *vaQueryVendorString (
VADisplay dpy
);
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
/**
* Return a function pointer given a function name in the library.
--
2.7.4
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
Emil Velikov
2016-11-21 15:32:58 UTC
Permalink
Post by Xiang, Haihao
Although taking unspecified arguments is obsolete, I don't see any failure caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?
Add "-pedantic" and you'll see a warning on pretty much any version of GCC.

-Emil
Xiang, Haihao
2016-11-22 03:19:11 UTC
Permalink
Post by Emil Velikov
Post by Xiang, Haihao
Although taking unspecified arguments is obsolete, I don't see any
failure caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?
Add "-pedantic" and you'll see a warning on pretty much any version of GCC.
Thanks, Emil. I see lots of warning with -pedantic.
Post by Emil Velikov
-Emil
Li, ZhijianX
2016-11-22 00:51:45 UTC
Permalink
-----Original Message-----
From: Xiang, Haihao
Sent: Monday, November 21, 2016 11:25 PM
Subject: RE: [Libva] [PATCH] va.h: fix compile warning
Although taking unspecified arguments is obsolete, I don't see any failure
caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?
If we specify compiling option with "-Werror=strict-prototypes", we can got the following failure.
/opt/yami/vaapi/include/va/va.h:294:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
typedef int (*VAPrivFunc)();
^

Currently, I got this failure while I included this header to QEMU.

Thanks
Zhijian
Thanks
Haihao
-----Original Message-----
Zhijian
Sent: Monday, November 21, 2016 6:18 PM
Subject: [Libva] [PATCH] va.h: fix compile warning
define the VAPrivFunc with parameter 'void'
va.h will be installed, and it will cause a compiling failure if someone
include
this header to his code. So this change make the compiler happy.
---
va/va.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/va/va.h b/va/va.h
index 153a89b..8791906 100644
--- a/va/va.h
+++ b/va/va.h
@@ -291,7 +291,7 @@ const char *vaQueryVendorString (
VADisplay dpy
);
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
/**
* Return a function pointer given a function name in the library.
--
2.7.4
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
Zhao Yakui
2016-11-22 01:32:15 UTC
Permalink
Post by Li, ZhijianX
-----Original Message-----
From: Xiang, Haihao
Sent: Monday, November 21, 2016 11:25 PM
Subject: RE: [Libva] [PATCH] va.h: fix compile warning
Although taking unspecified arguments is obsolete, I don't see any failure
caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?
If we specify compiling option with "-Werror=strict-prototypes", we can got the following failure.
/opt/yami/vaapi/include/va/va.h:294:1: error: function declaration isn't a prototype [-Werror=strict-prototypes]
typedef int (*VAPrivFunc)();
^
Currently, I got this failure while I included this header to QEMU.
If so, the below info had better be added into the commit log.
Post by Li, ZhijianX
If we specify compiling option with "-Werror=strict-prototypes", we
can get the following failure.
va/va.h:294:1: error: function declaration isn't a prototype
[-Werror=strict-prototypes]
typedef int (*VAPrivFunc)();

This patch is fine to me.

Thanks
Yakui
Post by Li, ZhijianX
Thanks
Zhijian
Thanks
Haihao
-----Original Message-----
Zhijian
Sent: Monday, November 21, 2016 6:18 PM
Subject: [Libva] [PATCH] va.h: fix compile warning
define the VAPrivFunc with parameter 'void'
va.h will be installed, and it will cause a compiling failure if someone
include
this header to his code. So this change make the compiler happy.
---
va/va.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/va/va.h b/va/va.h
index 153a89b..8791906 100644
--- a/va/va.h
+++ b/va/va.h
@@ -291,7 +291,7 @@ const char *vaQueryVendorString (
VADisplay dpy
);
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
/**
* Return a function pointer given a function name in the library.
--
2.7.4
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
Xiang, Haihao
2016-11-22 04:28:19 UTC
Permalink
I also see the same error with '-Werror=strict-prototypes'. 

It might causes a compatibility issue if user writes similar code
below:

  VAPrivFunc foo = vaGetLibFunc(va_dpy, "va_priv_foo");

  if (foo)
foo("testing");

error info:
161:7: error: too many arguments to function ‘foo’
       foo("testing");
       ^
However I think user should cast the returned pointer(foo) to a right
type first, so I am fine with your patch except the commit log. Could
you update the log, like as what yakui suggested in the comment?

Thanks
Haihao
Post by Zhao Yakui
Post by Li, ZhijianX
-----Original Message-----
From: Xiang, Haihao
Sent: Monday, November 21, 2016 11:25 PM
org
Subject: RE: [Libva] [PATCH] va.h: fix compile warning
Although taking unspecified arguments is obsolete, I don't see any failure
caused by ' typedef int (*VAPrivFunc)()'
Which compiler are you using, could you provide more info in the commit log?
If we specify compiling option with "-Werror=strict-prototypes", we
can got the following failure.
/opt/yami/vaapi/include/va/va.h:294:1: error: function declaration
isn't a prototype [-Werror=strict-prototypes]
  typedef int (*VAPrivFunc)();
  ^
Currently, I got this failure while I included this header to QEMU.
If so, the below info had better be added into the commit log.
    >If we specify compiling option with "-Werror=strict-prototypes",
we
can get the following failure.
     va/va.h:294:1: error: function declaration isn't a prototype
[-Werror=strict-prototypes]
   typedef int (*VAPrivFunc)();
This patch is fine to me.
Thanks
    Yakui
Post by Li, ZhijianX
Thanks
Zhijian
Thanks
Haihao
-----Original Message-----
Zhijian
Sent: Monday, November 21, 2016 6:18 PM
Subject: [Libva] [PATCH] va.h: fix compile warning
define the VAPrivFunc with parameter 'void'
va.h will be installed, and it will cause a compiling failure if someone
include
this header to his code. So this change make the compiler happy.
---
va/va.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/va/va.h b/va/va.h
index 153a89b..8791906 100644
--- a/va/va.h
+++ b/va/va.h
@@ -291,7 +291,7 @@ const char *vaQueryVendorString (
     VADisplay dpy
);
-typedef int (*VAPrivFunc)();
+typedef int (*VAPrivFunc)(void);
/**
  * Return a function pointer given a function name in the
library.
--
2.7.4
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
_______________________________________________
Libva mailing list
https://lists.freedesktop.org/mailman/listinfo/libva
Loading...