public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/power-ieee128] Allow for multiple defaults in endianness and r16 in GFORTRAN_CONVERT_UNIT.
@ 2022-01-15 10:31 Thomas König
  0 siblings, 0 replies; only message in thread
From: Thomas König @ 2022-01-15 10:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f660638317ef7c79eee6640d0275c9e8fc34beba

commit f660638317ef7c79eee6640d0275c9e8fc34beba
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Sat Jan 15 11:30:20 2022 +0100

    Allow for multiple defaults in endianness and r16 in GFORTRAN_CONVERT_UNIT.
    
    With this patch, it is possible to specify multiple defaults inthe
    GFORTRAN_CONVERT_UNIT environment variable so that, for example, R16_IEEE
    and BIG_ENDIAN can be specified together.
    
    libgfortran/ChangeLog:
    
            * runtime/environ.c: Allow for multiple default values so that
            separate default specifications for IBM long double format and
            endianness are possible.

Diff:
---
 libgfortran/runtime/environ.c | 111 +++++++++++++++++++++---------------------
 1 file changed, 56 insertions(+), 55 deletions(-)

diff --git a/libgfortran/runtime/environ.c b/libgfortran/runtime/environ.c
index ff10fe53f68..3dd75ca22e3 100644
--- a/libgfortran/runtime/environ.c
+++ b/libgfortran/runtime/environ.c
@@ -500,78 +500,79 @@ do_parse (void)
 
   unit_count = 0;
 
-  start = p;
-
   /* Parse the string.  First, let's look for a default.  */
-  tok = next_token ();
   endian = 0;
-
-  switch (tok)
+  while (1)
     {
-    case NATIVE:
-      endian = GFC_CONVERT_NATIVE;
-      break;
+      start = p;
+      tok = next_token ();
+      switch (tok)
+	{
+	case NATIVE:
+	  endian = GFC_CONVERT_NATIVE;
+	  break;
 
-    case SWAP:
-      endian = GFC_CONVERT_SWAP;
-      break;
+	case SWAP:
+	  endian = GFC_CONVERT_SWAP;
+	  break;
 
-    case BIG:
-      endian = GFC_CONVERT_BIG;
-      break;
+	case BIG:
+	  endian = GFC_CONVERT_BIG;
+	  break;
 
-    case LITTLE:
-      endian = GFC_CONVERT_LITTLE;
-      break;
+	case LITTLE:
+	  endian = GFC_CONVERT_LITTLE;
+	  break;
 
 #ifdef HAVE_GFC_REAL_17
-    case R16_IEEE:
-      endian = GFC_CONVERT_R16_IEEE;
-      break;
+	case R16_IEEE:
+	  endian = GFC_CONVERT_R16_IEEE;
+	  break;
 
-    case R16_IBM:
-      endian = GFC_CONVERT_R16_IBM;
-      break;
+	case R16_IBM:
+	  endian = GFC_CONVERT_R16_IBM;
+	  break;
 #endif
-    case INTEGER:
-      /* A leading digit means that we are looking at an exception.
-	 Reset the position to the beginning, and continue processing
-	 at the exception list.  */
-      p = start;
-      goto exceptions;
-      break;
+	case INTEGER:
+	  /* A leading digit means that we are looking at an exception.
+	     Reset the position to the beginning, and continue processing
+	     at the exception list.  */
+	  p = start;
+	  goto exceptions;
+	  break;
 
-    case END:
-      goto end;
-      break;
+	case END:
+	  goto end;
+	  break;
 
-    default:
-      goto error;
-      break;
+	default:
+	  goto error;
+	  break;
     }
 
-  tok = next_token ();
-  switch (tok)
-    {
-    case ';':
-      def = endian;
-      break;
+      tok = next_token ();
+      switch (tok)
+	{
+	case ';':
+	  def = def == GFC_CONVERT_NONE ? endian : def | endian;
+	  break;
 
-    case ':':
-      /* This isn't a default after all.  Reset the position to the
-	 beginning, and continue processing at the exception list.  */
-      p = start;
-      goto exceptions;
-      break;
+	case ':':
+	  /* This isn't a default after all.  Reset the position to the
+	     beginning, and continue processing at the exception list.  */
+	  p = start;
+	  goto exceptions;
+	  break;
 
-    case END:
-      def = endian;
-      goto end;
-      break;
+	case END:
+	  def = def == GFC_CONVERT_NONE ? endian : def | endian;
+	  goto end;
+	  break;
 
-    default:
-      goto error;
-      break;
+	default:
+	  goto error;
+	  break;
+	}
     }
 
  exceptions:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-15 10:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-15 10:31 [gcc/devel/power-ieee128] Allow for multiple defaults in endianness and r16 in GFORTRAN_CONVERT_UNIT Thomas König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).