[gcc/devel/omp/gcc-16] Fortran: Add debug functions for OpenMP data structures

Sandra Loosemore via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:c103cb89fab62d4b8e76e8b328decc50271287c4

commit c103cb89fab62d4b8e76e8b328decc50271287c4
Author: Paul-Antoine Arras <[email protected]>
Date:   Wed May 6 20:07:44 2026 +0200

    Fortran: Add debug functions for OpenMP data structures
    
    show_omp_namelist and show_omp_clauses cannot be called from GDB because
    dumpfile is NULL at debug time. Add debug wrappers that temporarily set it to
    stderr.
    
    gcc/fortran/ChangeLog:
    
            * dump-parse-tree.cc (debug): Add debug functions for gfc_omp_namelist
            and gfc_omp_clauses.
    
    (cherry picked from commit c028b7c645514cfbd682bef364734314c01745d6)

Diff:
---
 gcc/fortran/dump-parse-tree.cc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gcc/fortran/dump-parse-tree.cc b/gcc/fortran/dump-parse-tree.cc
index 92f99558d8c7..64757d16c801 100644
--- a/gcc/fortran/dump-parse-tree.cc
+++ b/gcc/fortran/dump-parse-tree.cc
@@ -4727,3 +4727,25 @@ debug (gfc_array_ref *ar)
   fputc ('\n', dumpfile);
   dumpfile = tmp;
 }
+
+/* Dump OpenMP data structures.  */
+
+DEBUG_FUNCTION void
+debug (gfc_omp_namelist *n)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_omp_namelist (OMP_LIST_MAP, n);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}
+
+DEBUG_FUNCTION void
+debug (gfc_omp_clauses *clauses)
+{
+  FILE *tmp = dumpfile;
+  dumpfile = stderr;
+  show_omp_clauses (clauses);
+  fputc ('\n', dumpfile);
+  dumpfile = tmp;
+}
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.