[gcc r17-2503] cobol: portability for Darwin.

"James K. Lowden via Gcc-cvs" <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:1c51d043fa826788aee2688924e73882c031f473

commit r17-2503-g1c51d043fa826788aee2688924e73882c031f473
Author: James K. Lowden <[email protected]>
Date:   Fri Jul 17 16:25:30 2026 -0400

    cobol: portability for Darwin.
    
    With this change https://github.com/iains/gcc-darwin-arm64 commit
    f576c64ad77e65fb054365839a4ea80a79398e45 builds successfully.
    
    gcc/cobol/ChangeLog:
    
            PR cobol/122466
            * copybook.h: Include sys/types.h
            * parse.y: Cast size for printf %lu parameter.
            * util.cc (cobol_filename): Same.

Diff:
---
 gcc/cobol/copybook.h | 2 ++
 gcc/cobol/parse.y    | 2 +-
 gcc/cobol/util.cc    | 4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/cobol/copybook.h b/gcc/cobol/copybook.h
index 93c87b70ea83..a19418fc361b 100644
--- a/gcc/cobol/copybook.h
+++ b/gcc/cobol/copybook.h
@@ -33,6 +33,8 @@
 #else
 #define _COPYBOOK_H
 
+#include <sys/types.h> // where macOS defines ino_t
+
 #if defined(CDF_Y)
 #define gcc_assert(x) assert(x)
 void gcc_unreachable(void);
diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
index 05ce448f7036..af3c4856e2f2 100644
--- a/gcc/cobol/parse.y
+++ b/gcc/cobol/parse.y
@@ -4644,7 +4644,7 @@ data_clauses:   data_clause
                         dbgmsg("expanding %s size from %u bytes to %lu "
 			       "because it redefines %s with USAGE POINTER",
                                field->name, field->size(),
-                               int_size_in_bytes(ptr_type_node),
+                               (unsigned long)int_size_in_bytes(ptr_type_node),
                                redefined->name);
                         field->embiggen();
                       }
diff --git a/gcc/cobol/util.cc b/gcc/cobol/util.cc
index 46d1d1875a76..64bcbf53ae26 100644
--- a/gcc/cobol/util.cc
+++ b/gcc/cobol/util.cc
@@ -3436,10 +3436,10 @@ bool cobol_filename( const char *name, ino_t inode ) {
   linemap_add(line_table, LC_ENTER, sysp, name, 1);
   input_filename_vestige = name;
   bool pushed = input_filenames.push( input_file_t(name, inode, 1) );
-  dbgmsg("%s: %s %s line %d-%d inode %ld", __func__,
+  dbgmsg("%s: %s %s line %d-%d inode %lu", __func__,
          pushed? "pushed" : "set to", name,
          cobol_location().first_line,
-         cobol_location().last_line, inode);
+         cobol_location().last_line, (unsigned long) inode);
   return pushed;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.