public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] lib: remove usage of `sys/cdefs.h`
@ 2021-08-20 18:20 Saleem Abdulrasool
  2021-08-23 12:42 ` Érico Nogueira
  0 siblings, 1 reply; 4+ messages in thread
From: Saleem Abdulrasool @ 2021-08-20 18:20 UTC (permalink / raw)
  To: elfutils-devel

This header is a BSD header that is also available in glibc.  However,
this is a not a standard C header and was used for `__CONCAT`.  Because
this is not a standard header, not all libc implementations provide the
header.  Remove the usage of the header and always use the previously
fallback path.  This is needed in order to build with musl.

Signed-off-by: Saleem Abdulrasool <abdulras@google.com>
---
 lib/fixedsizehash.h | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
index dac2a5f5..f333ad99 100644
--- a/lib/fixedsizehash.h
+++ b/lib/fixedsizehash.h
@@ -30,17 +30,12 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
-#include <sys/cdefs.h>
 
 #include <system.h>
 
-#ifdef __CONCAT
-#define CONCAT(t1,t2) __CONCAT (t1,t2)
-#else
 #define STROF(t2) t2
 #define CONCAT_EXPANDED(t1,t2) t1 ## t2
 #define CONCAT(t1,t2) CONCAT_EXPANDED(t1,t2)
-#endif
 
 /* Before including this file the following macros must be defined:
 
-- 
2.33.0.rc2.250.ged5fa647cd-goog


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

* Re: [PATCH] lib: remove usage of `sys/cdefs.h`
  2021-08-20 18:20 [PATCH] lib: remove usage of `sys/cdefs.h` Saleem Abdulrasool
@ 2021-08-23 12:42 ` Érico Nogueira
  2021-08-23 15:23   ` Saleem Abdulrasool
  0 siblings, 1 reply; 4+ messages in thread
From: Érico Nogueira @ 2021-08-23 12:42 UTC (permalink / raw)
  To: Saleem Abdulrasool, elfutils-devel

On Fri Aug 20, 2021 at 3:20 PM -03, Saleem Abdulrasool via Elfutils-devel wrote:
> This header is a BSD header that is also available in glibc. However,
> this is a not a standard C header and was used for `__CONCAT`. Because
> this is not a standard header, not all libc implementations provide the
> header. Remove the usage of the header and always use the previously
> fallback path. This is needed in order to build with musl.

On Void we provide our own <sys/cdefs.h> file, since way too many
packages require them. Explains why I missed this :)

>
> Signed-off-by: Saleem Abdulrasool <abdulras@google.com>
> ---
> lib/fixedsizehash.h | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
> index dac2a5f5..f333ad99 100644
> --- a/lib/fixedsizehash.h
> +++ b/lib/fixedsizehash.h
> @@ -30,17 +30,12 @@
> #include <errno.h>
> #include <stdlib.h>
> #include <string.h>
> -#include <sys/cdefs.h>
>  
> #include <system.h>
>  
> -#ifdef __CONCAT
> -#define CONCAT(t1,t2) __CONCAT (t1,t2)
> -#else
> #define STROF(t2) t2
> #define CONCAT_EXPANDED(t1,t2) t1 ## t2
> #define CONCAT(t1,t2) CONCAT_EXPANDED(t1,t2)
> -#endif

I think you can remove STROF from here too, can't you? I don't see it
being used anywhere.

>  
> /* Before including this file the following macros must be defined:
>  
> --
> 2.33.0.rc2.250.ged5fa647cd-goog


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

* Re: [PATCH] lib: remove usage of `sys/cdefs.h`
  2021-08-23 12:42 ` Érico Nogueira
@ 2021-08-23 15:23   ` Saleem Abdulrasool
  2021-08-27 15:11     ` Mark Wielaard
  0 siblings, 1 reply; 4+ messages in thread
From: Saleem Abdulrasool @ 2021-08-23 15:23 UTC (permalink / raw)
  To: Érico Nogueira; +Cc: elfutils-devel

Hi Érico,

Yes, it seems that `STROF` can be removed as well.  However, I'd
prefer to do that in a separate change.  This way the change is a
separate clean up rather than just happens to come along with the
sys/cdefs.h removal.

On Mon, Aug 23, 2021 at 5:48 AM Érico Nogueira <ericonr@disroot.org> wrote:
>
> On Fri Aug 20, 2021 at 3:20 PM -03, Saleem Abdulrasool via Elfutils-devel wrote:
> > This header is a BSD header that is also available in glibc. However,
> > this is a not a standard C header and was used for `__CONCAT`. Because
> > this is not a standard header, not all libc implementations provide the
> > header. Remove the usage of the header and always use the previously
> > fallback path. This is needed in order to build with musl.
>
> On Void we provide our own <sys/cdefs.h> file, since way too many
> packages require them. Explains why I missed this :)
>
> >
> > Signed-off-by: Saleem Abdulrasool <abdulras@google.com>
> > ---
> > lib/fixedsizehash.h | 5 -----
> > 1 file changed, 5 deletions(-)
> >
> > diff --git a/lib/fixedsizehash.h b/lib/fixedsizehash.h
> > index dac2a5f5..f333ad99 100644
> > --- a/lib/fixedsizehash.h
> > +++ b/lib/fixedsizehash.h
> > @@ -30,17 +30,12 @@
> > #include <errno.h>
> > #include <stdlib.h>
> > #include <string.h>
> > -#include <sys/cdefs.h>
> >
> > #include <system.h>
> >
> > -#ifdef __CONCAT
> > -#define CONCAT(t1,t2) __CONCAT (t1,t2)
> > -#else
> > #define STROF(t2) t2
> > #define CONCAT_EXPANDED(t1,t2) t1 ## t2
> > #define CONCAT(t1,t2) CONCAT_EXPANDED(t1,t2)
> > -#endif
>
> I think you can remove STROF from here too, can't you? I don't see it
> being used anywhere.
>
> >
> > /* Before including this file the following macros must be defined:
> >
> > --
> > 2.33.0.rc2.250.ged5fa647cd-goog
>

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

* Re: [PATCH] lib: remove usage of `sys/cdefs.h`
  2021-08-23 15:23   ` Saleem Abdulrasool
@ 2021-08-27 15:11     ` Mark Wielaard
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Wielaard @ 2021-08-27 15:11 UTC (permalink / raw)
  To: Saleem Abdulrasool, Érico Nogueira; +Cc: elfutils-devel

Hi Saleem,

On Mon, 2021-08-23 at 08:23 -0700, Saleem Abdulrasool via Elfutils-
devel wrote:
> Yes, it seems that `STROF` can be removed as well.  However, I'd
> prefer to do that in a separate change.  This way the change is a
> separate clean up rather than just happens to come along with the
> sys/cdefs.h removal.

Please do post a followup patch.

I added a ChangeLog entry (yes, we still do those, although it seems
very little people share my enthusiasm for them, so maybe we should
drop them, at least as separate file entries) and pushed your patch as:

commit d390548df1942e98a1d836269a5e41ba52e121f1
Author: Saleem Abdulrasool <abdulras@google.com>
Date:   Fri Aug 20 18:20:08 2021 +0000

    lib: remove usage of `sys/cdefs.h`
    
    This header is a BSD header that is also available in glibc.  However,
    this is a not a standard C header and was used for `__CONCAT`.  Because
    this is not a standard header, not all libc implementations provide the
    header.  Remove the usage of the header and always use the previously
    fallback path.  This is needed in order to build with musl.
    
    Signed-off-by: Saleem Abdulrasool <abdulras@google.com>

Thanks,

Mark

P.S. You might want to use git send-email --from=... to add an extra
From author line. Sadly the mailinglist mangles the original From in
some cases causing git am to apply a patch with the mailinglist as
author (sorry about that).

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

end of thread, other threads:[~2021-08-27 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 18:20 [PATCH] lib: remove usage of `sys/cdefs.h` Saleem Abdulrasool
2021-08-23 12:42 ` Érico Nogueira
2021-08-23 15:23   ` Saleem Abdulrasool
2021-08-27 15:11     ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).