backlight: Fix compile error
PATCH 1/1 backlight: Fix compile error
/usr/include/xorg/os.h around line 579 reads:
extern _X_EXPORT char *strndup(const char *str, size_t n);
However strndup is already defined by glibc, and this redefine causes a compile error.
This gets triggered because backlight.c does:
Without first doing:
Causing HAVE_STRNDUP to not be defined.
--- src/backlight.c | 1 + 1 file changed, 1 insertion(+)
src/backlight.c +1 -0
@@ -42,6 +42,7 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> +#include <xorg-server.h> #include <xf86.h> #include <pciaccess.h>
Signature · 1 line
2.0.0
Quoted 24 lines · Hans de Goede
/usr/include/xorg/os.haround line 579 reads:extern
_X_EXPORTchar *strndup(const char *str, size_t n);However strndup is already defined by glibc, and this redefine causes a compile error.
This gets triggered because
backlight.cdoes:Without first doing:
Causing
HAVE_STRNDUPto not be defined.Signed-off-by Hans de Goede <[email protected]>--- src/backlight.c | 1 + 1 file changed, 1 insertion(+)src/backlight.c +0
-0
src/backlight.c line 47
Quoted 6 lines
src/backlight.c +1
-0@@ -42,6 +42,7 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> +#include <xorg-server.h> #include <xf86.h> #include <pciaccess.h>
Does ordering it as
src/backlight.c +3 -1
@@ -29,6 +29,9 @@#include "config.h" #endif +#include <xorg-server.h> +#include <xf86.h> +#include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h>
@@ -42,7 +45,6 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> -#include <xf86.h> #include <pciaccess.h> #include "backlight.h"
make more sense?
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Hi,
Quoted 57 lines · Chris Wilson
Quoted 24 lines · Hans de Goede
/usr/include/xorg/os.haround line 579 reads:extern
_X_EXPORTchar *strndup(const char *str, size_t n);However strndup is already defined by glibc, and this redefine causes a compile error.
This gets triggered because
backlight.cdoes:Without first doing:
Causing
HAVE_STRNDUPto not be defined.Signed-off-by Hans de Goede <[email protected]>--- src/backlight.c | 1 + 1 file changed, 1 insertion(+)src/backlight.c +0
-0src/backlight.c line 47
Quoted 6 lines
src/backlight.c +1
-0@@ -42,6 +42,7 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> +#include <xorg-server.h> #include <xf86.h> #include <pciaccess.h> Does ordering it as
src/backlight.c +3
-1@@ -29,6 +29,9 @@#include "config.h" #endif +#include <xorg-server.h> +#include <xf86.h> +#include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> @@ -42,7 +45,6 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> -#include <xf86.h> #include <pciaccess.h> #include "backlight.h"
Quoted 1 line
make more sense?
I usually put specific "library" includes after standard libc includes, so IMHO no, if you move them up you should probably also move the pciaccess.h include up.
The important thing seems to be to include xorg-server.h before any other xserver includes.
Regards,
Hans
Quoted 60 lines · Hans de Goede
Hi,
Quoted 57 lines · Chris Wilson
Quoted 24 lines · Hans de Goede
/usr/include/xorg/os.haround line 579 reads:extern
_X_EXPORTchar *strndup(const char *str, size_t n);However strndup is already defined by glibc, and this redefine causes a compile error.
This gets triggered because
backlight.cdoes:Without first doing:
Causing
HAVE_STRNDUPto not be defined.Signed-off-by Hans de Goede <[email protected]>--- src/backlight.c | 1 + 1 file changed, 1 insertion(+)src/backlight.c +0
-0src/backlight.c line 47
Quoted 6 lines
src/backlight.c +1
-0@@ -42,6 +42,7 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> +#include <xorg-server.h> #include <xf86.h> #include <pciaccess.h> Does ordering it as
src/backlight.c +3
-1@@ -29,6 +29,9 @@#include "config.h" #endif +#include <xorg-server.h> +#include <xf86.h> +#include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> @@ -42,7 +45,6 @@#include <fcntl.h> #include <unistd.h> #include <dirent.h> -#include <xf86.h> #include <pciaccess.h> #include "backlight.h"
Quoted 7 lines
Quoted 1 line
make more sense?
I usually put specific "library" includes after standard libc includes, so IMHO no, if you move them up you should probably also move the
pciaccess.hinclude up.The important thing seems to be to include
xorg-server.hbefore any other xserver includes.
Right, so I usually put it first, and usually put <xf86*.h> last.
Quoted 5 lines
Regards,
Hans
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Quoted 8 lines · Hans de Goede
/usr/include/xorg/os.haround line 579 reads:extern
_X_EXPORTchar *strndup(const char *str, size_t n);However strndup is already defined by glibc, and this redefine causes a compile error.
Quoted 7 lines
This gets triggered because
backlight.cdoes:Without first doing:
Causing
HAVE_STRNDUPto not be defined.Signed-off-by Hans de Goede <[email protected]>
Pushed with one extra newline to break up the xorg headers from the rest.
Thanks,
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre