Fix C++11 invalid suffix on literal warning
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 20 Jul 2023 22:03:02 +0200
changeset 1101 f7a0e962650d
parent 1099 cdb045e8be20
child 1102 1610b6528b27
Fix C++11 invalid suffix on literal warning
absyntax_utils/debug_ast.cc
stage3/array_range_check.cc
--- a/absyntax_utils/debug_ast.cc	Fri Jul 22 09:24:12 2022 +0200
+++ b/absyntax_utils/debug_ast.cc	Thu Jul 20 22:03:02 2023 +0200
@@ -56,12 +56,12 @@
   else if (const_value._real64.is_nonconst()) fprintf(stderr, "nc");
   else                                        fprintf(stderr, "?");
   fprintf(stderr, ", i=");
-  if      (const_value. _int64.is_valid   ()) fprintf(stderr, "%"PRId64"", const_value. _int64.get());
+  if      (const_value. _int64.is_valid   ()) fprintf(stderr, "%" PRId64 "", const_value. _int64.get());
   else if (const_value. _int64.is_overflow()) fprintf(stderr, "ov");
   else if (const_value. _int64.is_nonconst()) fprintf(stderr, "nc");
   else                                        fprintf(stderr, "?");
   fprintf(stderr, ", u=");
-  if      (const_value._uint64.is_valid   ()) fprintf(stderr, "%"PRIu64"", const_value._uint64.get());
+  if      (const_value._uint64.is_valid   ()) fprintf(stderr, "%" PRIu64 "", const_value._uint64.get());
   else if (const_value._uint64.is_overflow()) fprintf(stderr, "ov");
   else if (const_value._uint64.is_nonconst()) fprintf(stderr, "nc");
   else                                        fprintf(stderr, "?");
--- a/stage3/array_range_check.cc	Fri Jul 22 09:24:12 2022 +0200
+++ b/stage3/array_range_check.cc	Thu Jul 20 22:03:02 2023 +0200
@@ -135,36 +135,36 @@
     /* Check lower limit */
     if ( VALID_CVALUE( int64, l->get_element(i)) && VALID_CVALUE( int64, dimension->lower_limit))
       if ( GET_CVALUE( int64, l->get_element(i)) < GET_CVALUE( int64, dimension->lower_limit) )
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be >= %"PRId64").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE( int64, dimension->lower_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRId64 ", should be >= %" PRId64 ").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE( int64, dimension->lower_limit)); continue;}
 
     if ( VALID_CVALUE( int64, l->get_element(i)) && VALID_CVALUE(uint64, dimension->lower_limit))
       if ( cmp_unsigned_signed( GET_CVALUE(uint64, dimension->lower_limit), GET_CVALUE( int64, l->get_element(i))) > 0 )
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be >= %"PRIu64").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE(uint64, dimension->lower_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRId64 ", should be >= %" PRIu64 ").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE(uint64, dimension->lower_limit)); continue;}
 
     if ( VALID_CVALUE(uint64, l->get_element(i)) && VALID_CVALUE(uint64, dimension->lower_limit))
       if ( GET_CVALUE(uint64, l->get_element(i))   <  GET_CVALUE(uint64, dimension->lower_limit))
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be >= %"PRIu64").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE(uint64, dimension->lower_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRIu64 ", should be >= %" PRIu64 ").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE(uint64, dimension->lower_limit)); continue;}
 
     if ( VALID_CVALUE(uint64, l->get_element(i)) && VALID_CVALUE( int64, dimension->lower_limit))
       if ( cmp_unsigned_signed(GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->lower_limit)) < 0 )
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be >= %"PRId64").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->lower_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRIu64 ", should be >= %" PRId64 ").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->lower_limit)); continue;}
 
     /* Repeat the same check, now for upper limit */
     if ( VALID_CVALUE( int64, l->get_element(i)) && VALID_CVALUE( int64, dimension->upper_limit))
       if ( GET_CVALUE( int64, l->get_element(i))   >  GET_CVALUE( int64, dimension->upper_limit))
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be <= %"PRId64").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE( int64, dimension->upper_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRId64 ", should be <= %" PRId64 ").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE( int64, dimension->upper_limit)); continue;}
 
     if ( VALID_CVALUE( int64, l->get_element(i)) && VALID_CVALUE(uint64, dimension->upper_limit))
       if ( cmp_unsigned_signed( GET_CVALUE(uint64, dimension->upper_limit), GET_CVALUE( int64, l->get_element(i))) < 0 )
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be <= %"PRIu64").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE(uint64, dimension->upper_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRId64 ", should be <= %" PRIu64 ").", GET_CVALUE( int64, l->get_element(i)), GET_CVALUE(uint64, dimension->upper_limit)); continue;}
 
     if ( VALID_CVALUE(uint64, l->get_element(i)) && VALID_CVALUE(uint64, dimension->upper_limit))
       if ( GET_CVALUE(uint64, l->get_element(i))   >  GET_CVALUE(uint64, dimension->upper_limit))
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be <= %"PRIu64").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE(uint64, dimension->upper_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRIu64 ", should be <= %" PRIu64 ").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE(uint64, dimension->upper_limit)); continue;}
       
     if ( VALID_CVALUE(uint64, l->get_element(i)) && VALID_CVALUE( int64, dimension->upper_limit))
       if ( cmp_unsigned_signed(GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->upper_limit)) > 0 )
-      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be <= %"PRId64").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->upper_limit)); continue;}
+      {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %" PRIu64 ", should be <= %" PRId64 ").", GET_CVALUE(uint64, l->get_element(i)), GET_CVALUE( int64, dimension->upper_limit)); continue;}
       
   }
 }
@@ -199,7 +199,7 @@
 		// remember that the result (dimension) is unsigned, while the operands are signed!!
 		// dimension = GET_CVALUE( int64, symbol->upper_limit) - VALID_CVALUE( int64, symbol->lower_limit);
 		if  (GET_CVALUE( int64, symbol->lower_limit)  >   GET_CVALUE( int64, symbol->upper_limit)) {
-			STAGE3_ERROR(0, symbol, symbol, "Subrange has lower limit (%"PRId64") larger than upper limit (%"PRId64").", GET_CVALUE( int64, symbol->lower_limit), GET_CVALUE( int64, symbol->upper_limit));
+			STAGE3_ERROR(0, symbol, symbol, "Subrange has lower limit (%" PRId64 ") larger than upper limit (%" PRId64 ").", GET_CVALUE( int64, symbol->lower_limit), GET_CVALUE( int64, symbol->upper_limit));
 			dimension = std::numeric_limits< unsigned long long int >::max() - 1; // -1 because it will be incremented at the end of this function!! 
 		} else if (GET_CVALUE( int64, symbol->lower_limit) >= 0) {
 			dimension = GET_CVALUE( int64, symbol->upper_limit) - GET_CVALUE( int64, symbol->lower_limit);
@@ -209,7 +209,7 @@
 		}
 	} else if (VALID_CVALUE(uint64, symbol->upper_limit) && VALID_CVALUE(uint64, symbol->lower_limit)) {
 		if  (GET_CVALUE(uint64, symbol->lower_limit)  >   GET_CVALUE(uint64, symbol->upper_limit)) {
-			STAGE3_ERROR(0, symbol, symbol, "Subrange has lower limit (%"PRIu64") larger than upper limit (%"PRIu64").", GET_CVALUE(uint64, symbol->lower_limit), GET_CVALUE(uint64, symbol->upper_limit));
+			STAGE3_ERROR(0, symbol, symbol, "Subrange has lower limit (%" PRIu64 ") larger than upper limit (%" PRIu64 ").", GET_CVALUE(uint64, symbol->lower_limit), GET_CVALUE(uint64, symbol->upper_limit));
 			dimension = std::numeric_limits< unsigned long long int >::max() - 1; // -1 because it will be incremented at the end of this function!! 
 		} else
 			dimension = GET_CVALUE(uint64, symbol->upper_limit) - GET_CVALUE(uint64, symbol->lower_limit);