From patchwork Sat Feb 28 22:03:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Pluzhnikov X-Patchwork-Id: 5361 Received: (qmail 70573 invoked by alias); 28 Feb 2015 22:03:48 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 70557 invoked by uid 89); 28 Feb 2015 22:03:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_FROM_URIBL_PCCC, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail-ob0-f179.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:content-type; bh=DfZ9ce+tE5lYr7g3jp9ksJsOW4nRBLqdgaE9vjromCA=; b=ImkXxdenWCNfvq0OktpFtJ3VIkBfdRPtzyfGCbjvhd6K2iA3KtU4oxWFDyGfBHZNRw aHWIf2xOEL3NOy9woflac61FaDSJglcp045gp8ri0b/zL16H8tQmNRkUMGivZ/150En2 pZaCYZHrG4CFIihWC3FceUIZg6SgbUKSc+nR02TWTdjtB2jdEqE8P8YvszBj14CWlU9H CvMg/bJ7EybI/fr/hiOvJruSlCM/vM4Os0+aXDi6QgKQguRL1RhkMgEoDTxiq8EzEqZI yAZGF+Hi4e2XUyXFsT3AAYeyu4eJQYf0ZXeQ/6JOO3orpFP/nKVVdl6LVfFig1NUkk/j xtLg== X-Gm-Message-State: ALoCoQkKrUdFEsOkiumhqrNBM5py2PJCPxDqT+LeosR9xtA2GRSuPSflr/8v/H+XHhQZL9SIwpvj X-Received: by 10.182.81.98 with SMTP id z2mr14753935obx.35.1425161023388; Sat, 28 Feb 2015 14:03:43 -0800 (PST) MIME-Version: 1.0 From: Paul Pluzhnikov Date: Sat, 28 Feb 2015 14:03:11 -0800 Message-ID: Subject: [patch] For BZ #17328, mark __errno_location with __attribute__((returns_nonnull)) for gcc >=4.9.0 To: GLIBC Devel Greetings, Tested on Linux/x86_64 with gcc-4.8 and 5.0. 2015-02-28 Paul Pluzhnikov [BZ #17328] * include/errno.h (__errno_locaiton): Mark returns_nonnull. * sysdeps/mach/hurd/bits/errno.h (__errno_location): Likewise. * sysdeps/unix/sysv/linux/alpha/bits/errno.h (__errno_location): Likewise. * sysdeps/unix/sysv/linux/bits/errno.h (__errno_location): Likewise * sysdeps/unix/sysv/linux/hppa/bits/errno.h (__errno_location): Likewise. * sysdeps/unix/sysv/linux/mips/bits/errno.h (__errno_location): Likewise. * sysdeps/unix/sysv/linux/sparc/bits/errno.h (__errno_location): Likewise. --- Paul Pluzhnikov diff --git a/include/errno.h b/include/errno.h index 7df41df..a7615a4 100644 --- a/include/errno.h +++ b/include/errno.h @@ -40,6 +40,9 @@ extern __thread int errno attribute_tls_model_ie; # ifndef __ASSEMBLER__ extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif # if RTLD_PRIVATE_ERRNO attribute_hidden # endif diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h index d20ffe6..5e84174 100644 --- a/sysdeps/mach/hurd/bits/errno.h +++ b/sysdeps/mach/hurd/bits/errno.h @@ -317,7 +317,11 @@ typedef enum __error_t_codes error_t; /* Return the current thread's location for `errno'. The syntax of this function allows redeclarations like `int errno'. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +#if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +#endif +; #define errno (*__errno_location ()) diff --git a/sysdeps/unix/sysv/linux/alpha/bits/errno.h b/sysdeps/unix/sysv/linux/alpha/bits/errno.h index 6e8c5cd..02dd301 100644 --- a/sysdeps/unix/sysv/linux/alpha/bits/errno.h +++ b/sysdeps/unix/sysv/linux/alpha/bits/errno.h @@ -46,7 +46,11 @@ # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif +; # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */ diff --git a/sysdeps/unix/sysv/linux/bits/errno.h b/sysdeps/unix/sysv/linux/bits/errno.h index b00c621..a982669 100644 --- a/sysdeps/unix/sysv/linux/bits/errno.h +++ b/sysdeps/unix/sysv/linux/bits/errno.h @@ -47,7 +47,11 @@ # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif +; # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/errno.h b/sysdeps/unix/sysv/linux/hppa/bits/errno.h index ad8f0b2..a46c752 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/errno.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/errno.h @@ -47,7 +47,11 @@ # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif +; # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/errno.h b/sysdeps/unix/sysv/linux/mips/bits/errno.h index 26e5a77..9da9bed 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/errno.h +++ b/sysdeps/unix/sysv/linux/mips/bits/errno.h @@ -46,7 +46,11 @@ # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif +; # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/errno.h b/sysdeps/unix/sysv/linux/sparc/bits/errno.h index 2fbafac..ce2d32e 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/errno.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/errno.h @@ -46,7 +46,11 @@ # ifndef __ASSEMBLER__ /* Function to get address of global `errno' variable. */ -extern int *__errno_location (void) __THROW __attribute__ ((__const__)); +extern int *__errno_location (void) __THROW __attribute__ ((__const__)) +# if __GNUC_PREREQ(4,9) + __attribute__((returns_nonnull)) +# endif +; # if !defined _LIBC || defined _LIBC_REENTRANT /* When using threads, errno is a per-thread value. */