This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

libm-test: Properly wrap blocks consisting of several statements.


Hi!

In math/libm-test.inc, when doing things like the following:

      if (SNAN_TESTS (FLOAT))
        TEST_f_f (gamma, snan_value, qnan_value, INVALID_EXCEPTION);

..., this is what appears in math/libm-test.c:

      if (SNAN_TESTS (FLOAT))
      signgam = 0;
      check_float ("gamma (sNaN) == qNaN",  FUNC(gamma) (snan_value), qnan_value, 0, 0, INVALID_EXCEPTION);

..., which is not quite what I intended.

Is the collowing patch OK?  I didn't bother with proper indentation of
the emitted statements, as the file is primarily meant for consumption by
the compiler only.

	* math/gen-libm-test.pl (parse_args, special_functions): Properly
	wrap blocks consisting of several statements.

diff --git math/gen-libm-test.pl math/gen-libm-test.pl
index 01e0fc2..0ac4d53 100755
--- math/gen-libm-test.pl
+++ math/gen-libm-test.pl
@@ -203,6 +203,7 @@ sub special_functions {
   unless ($args[0] =~ /sincos/) {
     die ("Don't know how to handle $args[0] extra.");
   }
+  print $file "  {\n";
   print $file "  FUNC (sincos) ($args[1], &sin_res, &cos_res);\n";
 
   $str = 'sincos (' . &beautify ($args[1]) . ', &sin_res, &cos_res)';
@@ -219,6 +220,7 @@ sub special_functions {
   # only tests once for exception
   $cline .= &new_test ($test, undef);
   print $file $cline;
+  print $file "  }\n";
 }
 
 # Parse the arguments to TEST_x_y
@@ -398,11 +400,11 @@ sub parse_args {
     }
   }
 
+  print $file "  {\n" if (defined $pre or defined $post);
   print $file $pre if (defined $pre);
-
   print $file "  $cline";
-
   print $file $post if (defined $post);
+  print $file "  }\n" if (defined $pre or defined $post);
 }
 
 # Generate libm-test.c


GrÃÃe,
 Thomas

Attachment: pgpDV1Ki6Poxt.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]