This is the mail archive of the 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]

[PATCH][benchtests] Append volatile keyword to type instead of prepending

On Wed, Dec 04, 2013 at 02:34:27PM +0000, Joseph S. Myers wrote:
> On Wed, 4 Dec 2013, Siddhesh Poyarekar wrote:
> > which I am unable to currently avoid because I need the volatile in
> > place to prevent gcc from inlining the math functions.  I'll figure
> > out a way to fix this warning later if that is OK.
> The logical equivalent for strtod would be const char *volatile - making 
> the pointer itself volatile - so make sure that "volatile" is being used 
> correctly to qualify whatever the relevant type is, regardless of the 
> syntax used for that type, rather than simply being concatenated with a 
> type name.

Thanks, since the current use cases for the input file are limited to
constant input data, i.e. numbers and strings and (maybe) structures
(and not their pointers), I believe we really only need const 'char *
volatile'.  Also, given that we can write 'volatile int' as 'int
volatile' and that we don't need more complicated semantics like 'char
volatile *' or similar, we could just append the volatile keyword to
the type instead of prepending.  Does that look OK?  I have verified
that it fixes the build warnings and the benchmark outputs are still


	* scripts/ Append volatile keyword to type.

diff --git a/scripts/ b/scripts/
index 90441e1..10f0ba4 100755
--- a/scripts/
+++ b/scripts/
@@ -98,7 +98,7 @@ my $bench_func = "#define CALL_BENCH_FUNC(v, i) $func (";
 my $outvars = "";
 if ($ret ne "void") {
-  $outvars = "static volatile $ret ret;\n";
+  $outvars = "static $ret volatile ret;\n";
 # Print the definitions and macros.
@@ -139,7 +139,7 @@ if (@args > 0) {
       $bench_func = "$bench_func &out$num";
     else {
-      $arg_struct = "$arg_struct volatile $arg arg$num;";
+      $arg_struct = "$arg_struct $arg volatile arg$num;";
       $bench_func = "$bench_func variants[v].in[i].arg$num";

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