# [PATCH] compat-util: add _DEFAULT_SOURCE define

3 messages from 2014-09-14 to 2014-09-17. Participants: Sergey Senozhatsky, Junio C Hamano.
Thread: https://gitlist.dev/t/37555

## Sergey Senozhatsky, 2014-09-14 05:33

Subject: [PATCH] compat-util: add _DEFAULT_SOURCE define
Message-ID: <1410672815-2555-1-git-send-email-sergey.senozhatsky@gmail.com>
URL: https://gitlist.dev/e/1410672815-2555-1-git-send-email-sergey.senozhatsky%40gmail.com

```
glibc has deprecated the use of _BSD_SOURCE define

  warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

To make it easier to maintain a cross platform source code, that
warning can be suppressed by _DEFAULT_SOURCE.

Define both _BSD_SOURCE, _DEFAULT_SOURCE and cleanup the build.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 git-compat-util.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/git-compat-util.h b/git-compat-util.h
index 4e7e3f8..08a9ee2 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -82,6 +82,7 @@
 #define _ALL_SOURCE 1
 #define _GNU_SOURCE 1
 #define _BSD_SOURCE 1
+#define _DEFAULT_SOURCE 1
 #define _NETBSD_SOURCE 1
 #define _SGI_SOURCE 1
 
-- 
2.1.0.350.g8b25fe0

```

## Junio C Hamano, 2014-09-15 19:02

Subject: Re: [PATCH] compat-util: add _DEFAULT_SOURCE define
Message-ID: <xmqq61go7lme.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq61go7lme.fsf%40gitster.dls.corp.google.com
In-Reply-To: <1410672815-2555-1-git-send-email-sergey.senozhatsky@gmail.com>

```
Sergey Senozhatsky <sergey.senozhatsky@gmail.com> writes:

> glibc has deprecated the use of _BSD_SOURCE define
>
>   warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
>
> To make it easier to maintain a cross platform source code, that
> warning can be suppressed by _DEFAULT_SOURCE.
>
> Define both _BSD_SOURCE, _DEFAULT_SOURCE and cleanup the build.

I can see you defined DEFAULT_SOURCE, but where did you do "cleanup
the build"?  Or did you mean "define both (in order) to clean up"?

Just making sure we are not only seeing a patch half eaten by mail
transport somewhere.

>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
>  git-compat-util.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 4e7e3f8..08a9ee2 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -82,6 +82,7 @@
>  #define _ALL_SOURCE 1
>  #define _GNU_SOURCE 1
>  #define _BSD_SOURCE 1
> +#define _DEFAULT_SOURCE 1
>  #define _NETBSD_SOURCE 1
>  #define _SGI_SOURCE 1

```

## Sergey Senozhatsky, 2014-09-17 03:54

Subject: Re: [PATCH] compat-util: add _DEFAULT_SOURCE define
Message-ID: <20140917035450.GA881@swordfish>
URL: https://gitlist.dev/e/20140917035450.GA881%40swordfish
In-Reply-To: <xmqq61go7lme.fsf@gitster.dls.corp.google.com>

```
Hello,

On (09/15/14 12:02), Junio C Hamano wrote:
> Date: Mon, 15 Sep 2014 12:02:33 -0700
> From: Junio C Hamano <gitster@pobox.com>
> To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> Cc: git@vger.kernel.org
> Subject: Re: [PATCH] compat-util: add _DEFAULT_SOURCE define
> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)
> 
> Sergey Senozhatsky <sergey.senozhatsky@gmail.com> writes:
> 
> > glibc has deprecated the use of _BSD_SOURCE define
> >
> >   warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
> >
> > To make it easier to maintain a cross platform source code, that
> > warning can be suppressed by _DEFAULT_SOURCE.
> >
> > Define both _BSD_SOURCE, _DEFAULT_SOURCE and cleanup the build.
> 
> I can see you defined DEFAULT_SOURCE, but where did you do "cleanup
> the build"?  Or did you mean "define both (in order) to clean up"?

yes. sorry, I meant "in order to clean up". otherwise, the build is
a bit noisy:

[..]
    CC base85.o
    CC bisect.o
    * new link flags
    * new prefix flags
    CC branch.o
    CC blob.o
In file included from /usr/include/unistd.h:25:0,
                 from git-compat-util.h:98,
                 from cache.h:4,
                 from blob.c:1:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/unistd.h:25:0,
                 from git-compat-util.h:98,
                 from branch.c:1:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/unistd.h:25:0,
                 from git-compat-util.h:98,
                 from cache.h:4,
                 from base85.c:1:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^
In file included from /usr/include/unistd.h:25:0,
                 from git-compat-util.h:98,
                 from cache.h:4,
                 from bisect.c:1:
/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
   ^

[..]

> Just making sure we are not only seeing a patch half eaten by mail
> transport somewhere.

sure.

	-ss

> >
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> > ---
> >  git-compat-util.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/git-compat-util.h b/git-compat-util.h
> > index 4e7e3f8..08a9ee2 100644
> > --- a/git-compat-util.h
> > +++ b/git-compat-util.h
> > @@ -82,6 +82,7 @@
> >  #define _ALL_SOURCE 1
> >  #define _GNU_SOURCE 1
> >  #define _BSD_SOURCE 1
> > +#define _DEFAULT_SOURCE 1
> >  #define _NETBSD_SOURCE 1
> >  #define _SGI_SOURCE 1
> 

```
