https://gcc.gnu.org/g:277c0c3e1a73f976a7437f69087bc3d1f72e54e5

commit r17-3938-g277c0c3e1a73f976a7437f69087bc3d1f72e54e5
Author: Iain Sandoe <[email protected]>
Date:   Fri Sep 4 19:52:15 2026 +0100

    testsuite, analyzer, Darwin: Handle missing O_CLOEXEC on earlier OS 
versions.
    
    Two of the tests make excplict use of O_CLOEXEC which is not provided
    on earlier Darwin versions.  In those case, for these tests it is
    sufficient to provide a dummy (set to the value used on later Darwin).
    
    With this, the tests work back to darwin9.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.dg/analyzer/mkostemp-1.c: Provide a dummy version of
            O_CLOEXEC where the OS headers omit it.
            * gcc.dg/analyzer/mkostemps-1.c: Likewise.
    
    Signed-off-by: Iain Sandoe <[email protected]>

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c  | 4 ++++
 gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c 
b/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c
index 539377c1ee05..a7e0edb3441a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c
@@ -9,6 +9,10 @@
 extern int mkostemp (char *, int);
 extern void populate (char *buf);
 
+#if defined(__APPLE__) && !defined(O_CLOEXEC)
+# define O_CLOEXEC 0x1000000
+#endif
+
 void test_passthrough (char *s, int flags)
 {
   mkostemp (s, flags);
diff --git a/gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c 
b/gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c
index 7961c8b6f639..727da62a4ed5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c
@@ -9,6 +9,10 @@
 extern int mkostemps (char *, int, int);
 extern void populate (char *buf);
 
+#if defined(__APPLE__) && !defined(O_CLOEXEC)
+# define O_CLOEXEC 0x1000000
+#endif
+
 void test_passthrough (char *s, int suffixlen, int flags)
 {
   mkostemps (s, suffixlen, flags);

Reply via email to