Skip to content

Commit

Permalink
Restore original ifdef in limits.h for the include_next of system's l…
Browse files Browse the repository at this point in the history
…imits.h

Commit 2f5f843 made changes to the
preprocessor guard that gated the include_next directive for limits.h

Currently the guard looks something like this:

```
ifdef __GNUC__
 include_next<limits.h>
endif
```

The original guard, on the other hand, also checked for _GCC_LIMITS_H_.
This extra condition is necessary to build with Clang. This error
message is shown:

> fatal error: 'limits.h' file not found

Because include_next is run when it shouldn't.
  • Loading branch information
vhscampos authored and keith-packard committed Aug 25, 2024
1 parent dc18492 commit 59843b2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions newlib/libc/include/limits.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,14 @@
/*
* Placing this outside of the above condition means that this will
* get run even from another picolibc provided limits.h file down the
* include chain.
* include chain. This also to see if the compiler limits.h has
* already been included as some clang configurations do that.
*/
#ifdef __GNUC__
#if defined __GNUC__ && !defined _GCC_LIMITS_H_
#ifdef __clang__
#ifndef __GLIBC_USE
#define __GLIBC_USE(x) 1
#endif
#endif
# include_next <limits.h>
#endif /* __GNUC__ */
#endif /* __GNUC__ && !_GCC_LIMITS_H_ */

0 comments on commit 59843b2

Please sign in to comment.