[cairo] [PATCH] replace _BSD_SOURCE with _DEFAULT_SOURCE

Bryce Harrington bryce at osg.samsung.com
Tue Sep 5 18:32:56 UTC 2017


On Sat, Sep 02, 2017 at 07:47:49PM +0930, Adrian Johnson wrote:
> This fixes the warnings about _BSD_SOURCE deprecated, replace with
> _DEFAULT_SOURCE.
> 
> _DEFAULT_SOURCE was added to glibc 2.19 released in Feb 2014. Do we need
> to support older versions of glibc?

I'm not sure if we document our version dependencies or dependency
policy anywhere, but I didn't spot anything on a cursory look.
Presumably as a minimum we'd want to continue support for the main LTS
versions; the oldest Ubuntu LTS is 14.04 which EOLs in April 2019.  But
they appear to have updated from 2.19 to 2.21
(https://launchpad.net/ubuntu/vivid/+source/glibc) so that may not be an
issue.  You could check RHEL but I expect it'd be a similar situation.

The only other major platform I'd be concerned with there is OSX, but I
don't know offhand what's required there.

A safe approach might be to land the change on trunk but not on the 1.14
stable branch; people needing old glibc support should probably be
focusing on 1.14 anyway.  Distros or platforms that want this patch can
opt-in to carrying it in their packaging if they wish.

I don't know when we'll cut 1.16.0, it might not be until next year, so
there should be ample time for testing and for the wider ecosystem to
catch up.  So, for trunk:

Acked-by: Bryce Harrington <bryce at osg.samsung.com>

> From e6292f7748e654deb2910db4711e5aed17604a51 Mon Sep 17 00:00:00 2001
> From: Adrian Johnson <ajohnson at redneon.com>
> Date: Sat, 2 Sep 2017 19:17:37 +0930
> Subject: [PATCH 2/2] replace _BSD_SOURCE with _DEFAULT_SOURCE
> 
> fixes the warning:
> 
> warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"
> ---
>  src/cairo-cff-subset.c           | 2 +-
>  src/cairo-ft-font.c              | 2 +-
>  src/cairo-output-stream.c        | 2 +-
>  src/cairo-path-stroke-boxes.c    | 2 +-
>  src/cairo-path-stroke-polygon.c  | 2 +-
>  src/cairo-path-stroke-tristrip.c | 2 +-
>  src/cairo-path-stroke.c          | 2 +-
>  src/cairo-pdf-surface.c          | 2 +-
>  src/cairo-ps-surface.c           | 2 +-
>  src/cairo-scaled-font-subsets.c  | 2 +-
>  src/cairo-svg-surface.c          | 2 +-
>  src/cairo-toy-font-face.c        | 2 +-
>  src/cairo-truetype-subset.c      | 2 +-
>  src/cairo-type1-fallback.c       | 2 +-
>  src/cairo-type1-subset.c         | 2 +-
>  15 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
> index bd3bfde70..49d981199 100644
> --- a/src/cairo-cff-subset.c
> +++ b/src/cairo-cff-subset.c
> @@ -41,7 +41,7 @@
>   * http://www.adobe.com/content/dam/Adobe/en/devnet/font/pdfs/5177.Type2.pdf
>   */
>  
> -#define _BSD_SOURCE /* for snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for snprintf(), strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-array-private.h"
> diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
> index 3b3087578..3a4663d95 100644
> --- a/src/cairo-ft-font.c
> +++ b/src/cairo-ft-font.c
> @@ -38,7 +38,7 @@
>   *      Carl Worth <cworth at cworth.org>
>   */
>  
> -#define _BSD_SOURCE /* for strdup() */
> +#define _DEFAULT_SOURCE /* for strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-error-private.h"
> diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c
> index 369a59bfb..07991703b 100644
> --- a/src/cairo-output-stream.c
> +++ b/src/cairo-output-stream.c
> @@ -33,7 +33,7 @@
>   *	Kristian Høgsberg <krh at redhat.com>
>   */
>  
> -#define _BSD_SOURCE /* for snprintf() */
> +#define _DEFAULT_SOURCE /* for snprintf() */
>  #include "cairoint.h"
>  
>  #include "cairo-output-stream-private.h"
> diff --git a/src/cairo-path-stroke-boxes.c b/src/cairo-path-stroke-boxes.c
> index 7f25bf76c..fba170c63 100644
> --- a/src/cairo-path-stroke-boxes.c
> +++ b/src/cairo-path-stroke-boxes.c
> @@ -36,7 +36,7 @@
>   *	Chris Wilson <chris at chris-wilson.co.uk>
>   */
>  
> -#define _BSD_SOURCE /* for hypot() */
> +#define _DEFAULT_SOURCE /* for hypot() */
>  #include "cairoint.h"
>  
>  #include "cairo-box-inline.h"
> diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c
> index e5082bbec..29050fa76 100644
> --- a/src/cairo-path-stroke-polygon.c
> +++ b/src/cairo-path-stroke-polygon.c
> @@ -37,7 +37,7 @@
>   *	Chris Wilson <chris at chris-wilson.co.uk>
>   */
>  
> -#define _BSD_SOURCE /* for hypot() */
> +#define _DEFAULT_SOURCE /* for hypot() */
>  #include "cairoint.h"
>  
>  #include "cairo-box-inline.h"
> diff --git a/src/cairo-path-stroke-tristrip.c b/src/cairo-path-stroke-tristrip.c
> index 6ce4131cc..317876560 100644
> --- a/src/cairo-path-stroke-tristrip.c
> +++ b/src/cairo-path-stroke-tristrip.c
> @@ -37,7 +37,7 @@
>   *	Chris Wilson <chris at chris-wilson.co.uk>
>   */
>  
> -#define _BSD_SOURCE /* for hypot() */
> +#define _DEFAULT_SOURCE /* for hypot() */
>  #include "cairoint.h"
>  
>  #include "cairo-box-inline.h"
> diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
> index 4d4ede813..64cec8f27 100644
> --- a/src/cairo-path-stroke.c
> +++ b/src/cairo-path-stroke.c
> @@ -36,7 +36,7 @@
>   *	Chris Wilson <chris at chris-wilson.co.uk>
>   */
>  
> -#define _BSD_SOURCE /* for hypot() */
> +#define _DEFAULT_SOURCE /* for hypot() */
>  #include "cairoint.h"
>  
>  #include "cairo-box-inline.h"
> diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
> index c258b7381..9e1547eac 100644
> --- a/src/cairo-pdf-surface.c
> +++ b/src/cairo-pdf-surface.c
> @@ -39,7 +39,7 @@
>   *	Adrian Johnson <ajohnson at redneon.com>
>   */
>  
> -#define _BSD_SOURCE /* for snprintf() */
> +#define _DEFAULT_SOURCE /* for snprintf() */
>  #include "cairoint.h"
>  
>  #include "cairo-pdf.h"
> diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
> index 1e020c056..e34f656cf 100644
> --- a/src/cairo-ps-surface.c
> +++ b/src/cairo-ps-surface.c
> @@ -53,7 +53,7 @@
>   *   2. Using gs to do PS -> PDF and PDF -> PS will always work well.
>   */
>  
> -#define _BSD_SOURCE /* for ctime_r(), snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for ctime_r(), snprintf(), strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-ps.h"
> diff --git a/src/cairo-scaled-font-subsets.c b/src/cairo-scaled-font-subsets.c
> index bf05fbd55..a239ec9b3 100644
> --- a/src/cairo-scaled-font-subsets.c
> +++ b/src/cairo-scaled-font-subsets.c
> @@ -40,7 +40,7 @@
>   *	Adrian Johnson <ajohnson at redneon.com>
>   */
>  
> -#define _BSD_SOURCE /* for snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for snprintf(), strdup() */
>  #include "cairoint.h"
>  #include "cairo-error-private.h"
>  
> diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
> index 2a020c017..e04eccc0b 100644
> --- a/src/cairo-svg-surface.c
> +++ b/src/cairo-svg-surface.c
> @@ -39,7 +39,7 @@
>   *	Carl Worth <cworth at cworth.org>
>   */
>  
> -#define _BSD_SOURCE /* for snprintf() */
> +#define _DEFAULT_SOURCE /* for snprintf() */
>  #include "cairoint.h"
>  
>  #include "cairo-svg.h"
> diff --git a/src/cairo-toy-font-face.c b/src/cairo-toy-font-face.c
> index 4fe94ab09..516f39195 100644
> --- a/src/cairo-toy-font-face.c
> +++ b/src/cairo-toy-font-face.c
> @@ -39,7 +39,7 @@
>   *      Behdad Esfahbod <behdad at behdad.org>
>   */
>  
> -#define _BSD_SOURCE /* for strdup() */
> +#define _DEFAULT_SOURCE /* for strdup() */
>  #include "cairoint.h"
>  #include "cairo-error-private.h"
>  
> diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
> index 62902cf7a..86593bc73 100644
> --- a/src/cairo-truetype-subset.c
> +++ b/src/cairo-truetype-subset.c
> @@ -40,7 +40,7 @@
>   * http://www.microsoft.com/typography/specs/default.htm
>   */
>  
> -#define _BSD_SOURCE /* for snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for snprintf(), strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-array-private.h"
> diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
> index 4a657413e..c8e7e908b 100644
> --- a/src/cairo-type1-fallback.c
> +++ b/src/cairo-type1-fallback.c
> @@ -33,7 +33,7 @@
>   *	Adrian Johnson <ajohnson at redneon.com>
>   */
>  
> -#define _BSD_SOURCE /* for snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for snprintf(), strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-array-private.h"
> diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
> index 16f821d9c..810dc9f74 100644
> --- a/src/cairo-type1-subset.c
> +++ b/src/cairo-type1-subset.c
> @@ -40,7 +40,7 @@
>   */
>  
>  
> -#define _BSD_SOURCE /* for snprintf(), strdup() */
> +#define _DEFAULT_SOURCE /* for snprintf(), strdup() */
>  #include "cairoint.h"
>  
>  #include "cairo-array-private.h"
> -- 
> 2.11.0
> 

> -- 
> cairo mailing list
> cairo at cairographics.org
> https://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list