Only include limits.h when actually used

The __extension__ seems to trigger a bug in gcc when there are no
identifier specified afterwards.

Testcase:
  echo "#include <stdlib.h>" > try.c && cc -O0 -c try.c
  try.c:2:0: error: expected identifier or '(' at end of input

With -O2 it does not happen.

We work around this by only pulling in limits.h when we actually need the
PATH_MAX.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
This commit is contained in:
Natanael Copa 2016-07-14 16:45:11 +02:00 committed by sin
parent 578b693300
commit 9880d5864b

View File

@ -19,12 +19,12 @@
__extension__
#include_next <stdlib.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
__extension__
#include_next <limits.h>
#endif
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
#include "fortify-headers.h"
#ifdef __cplusplus