When building with glibc and an -std= arg in CFLAGS, asort and cat
fail to build since sigsetjmp is guarded by _POSIX_C_SOURCE

In file included from bashjmp.h:24,
                 from shell.h:25,
                 from examples/loadables/cat.c:30:
include/posixjmp.h:29:25: error: unknown type name 'sigjmp_buf'
   29 | #  define procenv_t     sigjmp_buf
      |                         ^~~~~~~~~~
bashjmp.h:26:8: note: in expansion of macro 'procenv_t'
   26 | extern procenv_t        top_level;
      |        ^~~~~~~~~

Just moving up the builtins.h include is enough to fix this, but I'm
not sure if an explicit config.h include is needed (or clearer).
---
 examples/loadables/asort.c | 3 ++-
 examples/loadables/cat.c   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/examples/loadables/asort.c b/examples/loadables/asort.c
index 10003677..03b3c479 100644
--- a/examples/loadables/asort.c
+++ b/examples/loadables/asort.c
@@ -16,13 +16,14 @@
 */
 /* Contributed by Geir Hauge <geir.ha...@gmail.com> */
 
+#include "builtins.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <inttypes.h>
 
 #include "bashtypes.h"
 #include "shell.h"
-#include "builtins.h"
 #include "common.h"
 #include "xmalloc.h"
 #include "bashgetopt.h"
diff --git a/examples/loadables/cat.c b/examples/loadables/cat.c
index b476a0ee..ecb664ba 100644
--- a/examples/loadables/cat.c
+++ b/examples/loadables/cat.c
@@ -22,10 +22,11 @@
    along with Bash.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "builtins.h"
+
 #include <fcntl.h>
 #include <errno.h>
 
-#include "builtins.h"
 #include "shell.h"
 
 #ifndef errno
-- 
2.45.1


Reply via email to