am 0baf2ca3: Merge "Fix <features.h> (_BSD_SOURCE and _GNU_SOURCE)."

* commit '0baf2ca34c7d9ec067b1f33bad69782c2dedc231':
  Fix <features.h> (_BSD_SOURCE and _GNU_SOURCE).
This commit is contained in:
Elliott Hughes 2014-08-19 00:41:14 +00:00 committed by Android Git Automerger
commit 38ba927c35
7 changed files with 20 additions and 16 deletions

View File

@ -26,7 +26,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#define __GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <sched.h> #include <sched.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -25,18 +25,17 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#ifndef _FEATURES_H_ #ifndef _FEATURES_H_
#define _FEATURES_H_ #define _FEATURES_H_
/* certain Linux-specific programs expect a <features.h> header file #if defined(_BSD_SOURCE)
* that defines various features macros # define __USE_BSD 1
*/ #endif
/* we do include a number of BSD extensions */ #if defined(_GNU_SOURCE)
#define _BSD_SOURCE 1 # define __USE_GNU 1
#endif
/* we do include a number of GNU extensions */
#define _GNU_SOURCE 1
/* C95 support */ /* C95 support */
#undef __USE_ISOC95 #undef __USE_ISOC95

View File

@ -28,6 +28,7 @@
#ifndef _SCHED_H_ #ifndef _SCHED_H_
#define _SCHED_H_ #define _SCHED_H_
#include <features.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/time.h> #include <sys/time.h>
@ -52,7 +53,7 @@ extern int sched_setparam(pid_t, const struct sched_param*);
extern int sched_getparam(pid_t, struct sched_param*); extern int sched_getparam(pid_t, struct sched_param*);
extern int sched_rr_get_interval(pid_t, struct timespec*); extern int sched_rr_get_interval(pid_t, struct timespec*);
#ifdef _GNU_SOURCE #if defined(__USE_GNU)
extern int clone(int (*)(void*), void*, int, void*, ...); extern int clone(int (*)(void*), void*, int, void*, ...);
extern int unshare(int); extern int unshare(int);
@ -146,7 +147,7 @@ extern void __sched_cpufree(cpu_set_t* set);
extern int __sched_cpucount(size_t setsize, cpu_set_t* set); extern int __sched_cpucount(size_t setsize, cpu_set_t* set);
#endif /* _GNU_SOURCE */ #endif /* __USE_GNU */
__END_DECLS __END_DECLS

View File

@ -28,6 +28,7 @@
#ifndef _UNISTD_H_ #ifndef _UNISTD_H_
#define _UNISTD_H_ #define _UNISTD_H_
#include <features.h>
#include <stddef.h> #include <stddef.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/types.h> #include <sys/types.h>
@ -112,7 +113,7 @@ extern int chdir(const char *);
extern int fchdir(int); extern int fchdir(int);
extern int rmdir(const char *); extern int rmdir(const char *);
extern int pipe(int *); extern int pipe(int *);
#ifdef _GNU_SOURCE #if defined(__USE_GNU)
extern int pipe2(int *, int); extern int pipe2(int *, int);
#endif #endif
extern int chroot(const char *); extern int chroot(const char *);
@ -143,7 +144,7 @@ extern ssize_t pwrite64(int, const void *, size_t, off64_t);
extern int dup(int); extern int dup(int);
extern int dup2(int, int); extern int dup2(int, int);
#ifdef _GNU_SOURCE #if defined(__USE_GNU)
extern int dup3(int, int, int); extern int dup3(int, int, int);
#endif #endif
extern int fcntl(int, int, ...); extern int fcntl(int, int, ...);

View File

@ -17,6 +17,7 @@
#ifndef _MATH_H_ #ifndef _MATH_H_
#define _MATH_H_ #define _MATH_H_
#include <features.h>
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <limits.h> #include <limits.h>
@ -462,11 +463,11 @@ long double truncl(long double);
#endif /* __ISO_C_VISIBLE >= 1999 */ #endif /* __ISO_C_VISIBLE >= 1999 */
#if defined(_GNU_SOURCE) #if defined(__USE_GNU)
void sincos(double, double*, double*); void sincos(double, double*, double*);
void sincosf(float, float*, float*); void sincosf(float, float*, float*);
void sincosl(long double, long double*, long double*); void sincosl(long double, long double*, long double*);
#endif /* _GNU_SOURCE */ #endif /* __USE_GNU */
#pragma GCC visibility pop #pragma GCC visibility pop
__END_DECLS __END_DECLS

View File

@ -22,8 +22,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
*
*/ */
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <math.h> #include <math.h>

View File

@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#define _GNU_SOURCE 1
#include <math.h> #include <math.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>