[PATCH 4/13] Coarray shared memory library

Jerry D <[email protected]>
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Dear all, as requested,

See attached patch 4 of 13

Best Regards,

Jerry
pr88076_v4_4.diff (text/x-patch, 2.2 KB)
commit 6105783de07add3e95a6c1e1159dbc83b4dcaa7b
Author: Andre Vehreschild <[email protected]>
Date:   Wed Jun 18 09:23:32 2025 +0200

    Fortran: Fix signatures of coarray API and caf_single.
    
    The teams argument to some functions was marked as unused in the header.
    With upcoming caf_shmem this is incorrect, given the mark is repeated in
    caf_single.
    
    libgfortran/ChangeLog:
    
            * caf/libcaf.h (_gfortran_caf_failed_images): Team attribute is
            used now in some libs.
            (_gfortran_caf_image_status): Same.
            (_gfortran_caf_stopped_images): Same.
            * caf/single.c (caf_internal_error): Use correct printf function
            to handle va_list.

diff --git a/libgfortran/caf/libcaf.h b/libgfortran/caf/libcaf.h
index 06617a142b8..022ac5c365f 100644
--- a/libgfortran/caf/libcaf.h
+++ b/libgfortran/caf/libcaf.h
@@ -175,12 +175,9 @@ void _gfortran_caf_event_post (caf_token_t, size_t, int, int *, char *, size_t);
 void _gfortran_caf_event_wait (caf_token_t, size_t, int, int *, char *, size_t);
 void _gfortran_caf_event_query (caf_token_t, size_t, int, int *, int *);
 
-void _gfortran_caf_failed_images (gfc_descriptor_t *,
-				  caf_team_t * __attribute__ ((unused)), int *);
-int _gfortran_caf_image_status (int, caf_team_t * __attribute__ ((unused)));
-void _gfortran_caf_stopped_images (gfc_descriptor_t *,
-				   caf_team_t * __attribute__ ((unused)),
-				   int *);
+void _gfortran_caf_failed_images (gfc_descriptor_t *, caf_team_t *, int *);
+int _gfortran_caf_image_status (int, caf_team_t *);
+void _gfortran_caf_stopped_images (gfc_descriptor_t *, caf_team_t *, int *);
 
 void _gfortran_caf_random_init (bool, bool);
 
diff --git a/libgfortran/caf/single.c b/libgfortran/caf/single.c
index 7e02dff25d8..43c83e65ec4 100644
--- a/libgfortran/caf/single.c
+++ b/libgfortran/caf/single.c
@@ -129,7 +129,7 @@ caf_internal_error (const char *msg, int *stat, char *errmsg,
       *stat = 1;
       if (errmsg_len > 0)
 	{
-	  int len = snprintf (errmsg, errmsg_len, msg, args);
+	  int len = vsnprintf (errmsg, errmsg_len, msg, args);
 	  if (len >= 0 && errmsg_len > (size_t) len)
 	    memset (&errmsg[len], ' ', errmsg_len - len);
 	}
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.