All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] backlight: Fix compile error
@ 2014-06-18 12:41 Hans de Goede
  2014-06-18 12:51 ` Chris Wilson
  2014-06-18 13:12 ` Chris Wilson
  0 siblings, 2 replies; 5+ messages in thread
From: Hans de Goede @ 2014-06-18 12:41 UTC (permalink / raw)
  To: intel-gfx

/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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 src/backlight.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/backlight.c b/src/backlight.c
index d5b10a0..62241ab 100644
--- a/src/backlight.c
+++ b/src/backlight.c
@@ -42,6 +42,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <xorg-server.h>
 #include <xf86.h>
 #include <pciaccess.h>
 
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] backlight: Fix compile error
  2014-06-18 12:41 [PATCH] backlight: Fix compile error Hans de Goede
@ 2014-06-18 12:51 ` Chris Wilson
  2014-06-18 13:04   ` Hans de Goede
  2014-06-18 13:12 ` Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2014-06-18 12:51 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

On Wed, Jun 18, 2014 at 02:41:56PM +0200, Hans de Goede wrote:
> /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.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  src/backlight.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/backlight.c b/src/backlight.c
> index d5b10a0..62241ab 100644
> --- a/src/backlight.c
> +++ b/src/backlight.c
> @@ -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

diff --git a/src/backlight.c b/src/backlight.c
index d5b10a0..24eb11c 100644
--- a/src/backlight.c
+++ b/src/backlight.c
@@ -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

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] backlight: Fix compile error
  2014-06-18 12:51 ` Chris Wilson
@ 2014-06-18 13:04   ` Hans de Goede
  2014-06-18 13:11     ` Chris Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: Hans de Goede @ 2014-06-18 13:04 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

Hi,

On 06/18/2014 02:51 PM, Chris Wilson wrote:
> On Wed, Jun 18, 2014 at 02:41:56PM +0200, Hans de Goede wrote:
>> /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.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>  src/backlight.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/src/backlight.c b/src/backlight.c
>> index d5b10a0..62241ab 100644
>> --- a/src/backlight.c
>> +++ b/src/backlight.c
>> @@ -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
> 
> diff --git a/src/backlight.c b/src/backlight.c
> index d5b10a0..24eb11c 100644
> --- a/src/backlight.c
> +++ b/src/backlight.c
> @@ -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?

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] backlight: Fix compile error
  2014-06-18 13:04   ` Hans de Goede
@ 2014-06-18 13:11     ` Chris Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2014-06-18 13:11 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

On Wed, Jun 18, 2014 at 03:04:21PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 06/18/2014 02:51 PM, Chris Wilson wrote:
> > On Wed, Jun 18, 2014 at 02:41:56PM +0200, Hans de Goede wrote:
> >> /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.
> >>
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> >> ---
> >>  src/backlight.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/src/backlight.c b/src/backlight.c
> >> index d5b10a0..62241ab 100644
> >> --- a/src/backlight.c
> >> +++ b/src/backlight.c
> >> @@ -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
> > 
> > diff --git a/src/backlight.c b/src/backlight.c
> > index d5b10a0..24eb11c 100644
> > --- a/src/backlight.c
> > +++ b/src/backlight.c
> > @@ -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?
> 
> 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.

Right, so I usually put it first, and usually put <xf86*.h> last.
> 
> Regards,
> 
> Hans
> 

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] backlight: Fix compile error
  2014-06-18 12:41 [PATCH] backlight: Fix compile error Hans de Goede
  2014-06-18 12:51 ` Chris Wilson
@ 2014-06-18 13:12 ` Chris Wilson
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Wilson @ 2014-06-18 13:12 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

On Wed, Jun 18, 2014 at 02:41:56PM +0200, Hans de Goede wrote:
> /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.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Pushed with one extra newline to break up the xorg headers from the
rest.

Thanks,
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-18 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-18 12:41 [PATCH] backlight: Fix compile error Hans de Goede
2014-06-18 12:51 ` Chris Wilson
2014-06-18 13:04   ` Hans de Goede
2014-06-18 13:11     ` Chris Wilson
2014-06-18 13:12 ` Chris Wilson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.