[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master ccdeba2 2/3: Regularize placement of 'volatil
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master ccdeba2 2/3: Regularize placement of 'volatile' |
Date: |
Sat, 22 Apr 2017 16:52:25 -0400 (EDT) |
branch: master
commit ccdeba26876568bff8c68af328ea4c90beeddcba
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Regularize placement of 'volatile'
Write 'volatile' after the type it modifies. Incidentally adjust
alignment as appropriate.
---
alert_cgi.cpp | 2 +-
alert_cli.cpp | 4 ++--
alert_wx.cpp | 2 +-
bourn_cast_test.cpp | 4 ++--
cache_file_reads_test.cpp | 4 ++--
dbnames.cpp | 2 +-
fenv_lmi_x86.hpp | 4 ++--
file_command_cgi.cpp | 2 +-
file_command_cli.cpp | 2 +-
file_command_wx.cpp | 2 +-
group_quote_pdf_gen_wx.cpp | 2 +-
math_functors_test.cpp | 6 +++---
mc_enum_types_aux.cpp | 2 +-
miscellany_test.cpp | 8 ++++----
ncnnnpnn_test.cpp | 2 +-
numeric_io_test.cpp | 6 +++---
progress_meter_cgi.cpp | 2 +-
progress_meter_cli.cpp | 2 +-
progress_meter_wx.cpp | 2 +-
sigfpe.cpp | 14 +++++++-------
system_command_non_wx.cpp | 2 +-
system_command_wx.cpp | 2 +-
test_tools_test.cpp | 4 ++--
value_cast_test.cpp | 2 +-
24 files changed, 42 insertions(+), 42 deletions(-)
diff --git a/alert_cgi.cpp b/alert_cgi.cpp
index 9daf36b..b829aea 100644
--- a/alert_cgi.cpp
+++ b/alert_cgi.cpp
@@ -28,7 +28,7 @@
namespace
{
-volatile bool ensure_setup = set_alert_functions
+bool volatile ensure_setup = set_alert_functions
(status_alert
,warning_alert
,hobsons_choice_alert
diff --git a/alert_cli.cpp b/alert_cli.cpp
index 0f4baad..f671a30 100644
--- a/alert_cli.cpp
+++ b/alert_cli.cpp
@@ -29,7 +29,7 @@
namespace
{
-volatile bool ensure_setup = set_alert_functions
+bool volatile ensure_setup = set_alert_functions
(status_alert
,warning_alert
,hobsons_choice_alert
@@ -77,7 +77,7 @@ void hobsons_choice_alert(std::string const& s)
// certainly a poor choice for applications that should run
// unattended, such as servers or regression tests.
//
- static const volatile bool offer_hobsons_choice = false;
+ static bool const volatile offer_hobsons_choice = false;
if(offer_hobsons_choice)
{
std::cerr << s << '\n' << hobsons_prompt() << std::endl;
diff --git a/alert_wx.cpp b/alert_wx.cpp
index 2eabf58..a9605e8 100644
--- a/alert_wx.cpp
+++ b/alert_wx.cpp
@@ -40,7 +40,7 @@ LMI_FORCE_LINKING_IN_SITU(alert_wx)
namespace
{
-volatile bool ensure_setup = set_alert_functions
+bool volatile ensure_setup = set_alert_functions
(status_alert
,warning_alert
,hobsons_choice_alert
diff --git a/bourn_cast_test.cpp b/bourn_cast_test.cpp
index 0c9d290..39d2d40 100644
--- a/bourn_cast_test.cpp
+++ b/bourn_cast_test.cpp
@@ -648,7 +648,7 @@ void mete_static()
using from_traits = std::numeric_limits<From>;
static_assert(from_traits::is_specialized, "");
static_assert(N < from_traits::max(), "");
- volatile To z(0);
+ To volatile z(0);
for(From j = 0; j < N; ++j)
{
z = static_cast<To>(j);
@@ -665,7 +665,7 @@ void mete_bourn()
using from_traits = std::numeric_limits<From>;
static_assert(from_traits::is_specialized, "");
static_assert(N < from_traits::max(), "");
- volatile To z(0);
+ To volatile z(0);
for(From j = 0; j < N; ++j)
{
z = bourn_cast<To>(j);
diff --git a/cache_file_reads_test.cpp b/cache_file_reads_test.cpp
index 0ce3577..49f9cc8 100644
--- a/cache_file_reads_test.cpp
+++ b/cache_file_reads_test.cpp
@@ -102,13 +102,13 @@ void cache_file_reads_test::assay_speed()
void cache_file_reads_test::mete_uncached()
{
X const x("sample.ill");
- volatile std::string::size_type z = x.s().size();
+ std::string::size_type volatile z = x.s().size();
}
void cache_file_reads_test::mete_cached()
{
X const& x(*X::read_via_cache("sample.ill"));
- volatile std::string::size_type z = x.s().size();
+ std::string::size_type volatile z = x.s().size();
}
int test_main(int, char*[])
diff --git a/dbnames.cpp b/dbnames.cpp
index 6751879..2ceaaa6 100644
--- a/dbnames.cpp
+++ b/dbnames.cpp
@@ -79,7 +79,7 @@ std::vector<db_names> const& static_get_db_names()
static std::vector<db_names> const v(static_DBNames, static_DBNames + n);
- static volatile bool b = check_order(v);
+ static bool volatile b = check_order(v);
stifle_warning_for_unused_variable(b);
return v;
diff --git a/fenv_lmi_x86.hpp b/fenv_lmi_x86.hpp
index c845c92..788386a 100644
--- a/fenv_lmi_x86.hpp
+++ b/fenv_lmi_x86.hpp
@@ -318,7 +318,7 @@ inline unsigned short int default_x87_control_word()
inline unsigned short int x87_control_word()
{
- volatile unsigned short int control_word = 0x0;
+ unsigned short int volatile control_word = 0x0;
# if defined __GNUC__
asm volatile("fstcw %0" : : "m" (control_word));
# elif defined __BORLANDC__
@@ -337,7 +337,7 @@ inline unsigned short int x87_control_word()
inline void x87_control_word(unsigned short int cw)
{
# if defined __GNUC__
- volatile unsigned short int control_word = cw;
+ unsigned short int volatile control_word = cw;
asm volatile("fldcw %0" : : "m" (control_word));
# elif defined __BORLANDC__
_control87(cw, 0x0ffff);
diff --git a/file_command_cgi.cpp b/file_command_cgi.cpp
index 0c258f9..5ae139c 100644
--- a/file_command_cgi.cpp
+++ b/file_command_cgi.cpp
@@ -38,6 +38,6 @@ void concrete_file_command
;
}
-volatile bool ensure_setup = file_command_initialize(concrete_file_command);
+bool volatile ensure_setup = file_command_initialize(concrete_file_command);
} // Unnamed namespace.
diff --git a/file_command_cli.cpp b/file_command_cli.cpp
index 4d1f19a..9f2a758 100644
--- a/file_command_cli.cpp
+++ b/file_command_cli.cpp
@@ -38,6 +38,6 @@ void concrete_file_command
;
}
-volatile bool ensure_setup = file_command_initialize(concrete_file_command);
+bool volatile ensure_setup = file_command_initialize(concrete_file_command);
} // Unnamed namespace.
diff --git a/file_command_wx.cpp b/file_command_wx.cpp
index b7d1842..2290341 100644
--- a/file_command_wx.cpp
+++ b/file_command_wx.cpp
@@ -118,6 +118,6 @@ void concrete_file_command
/// and Kanze's reply:
/// http://groups.google.com/address@hidden
-volatile bool ensure_setup = file_command_initialize(concrete_file_command);
+bool volatile ensure_setup = file_command_initialize(concrete_file_command);
} // Unnamed namespace.
diff --git a/group_quote_pdf_gen_wx.cpp b/group_quote_pdf_gen_wx.cpp
index adb7a58..68405cb 100644
--- a/group_quote_pdf_gen_wx.cpp
+++ b/group_quote_pdf_gen_wx.cpp
@@ -1392,7 +1392,7 @@ void group_quote_pdf_generator_wx::output_footer
);
}
-volatile bool ensure_setup = group_quote_pdf_generator_wx::set_creator
+bool volatile ensure_setup = group_quote_pdf_generator_wx::set_creator
(group_quote_pdf_generator_wx::do_create
);
diff --git a/math_functors_test.cpp b/math_functors_test.cpp
index 9eaaa99..dfa979a 100644
--- a/math_functors_test.cpp
+++ b/math_functors_test.cpp
@@ -49,7 +49,7 @@ namespace
template<typename T>
bool lmi_isnan(T t)
{
- volatile T t0(t);
+ T volatile t0(t);
return t0 != t0;
}
@@ -184,7 +184,7 @@ void sample_results()
// less inaccurate than an alternative using expm1l() and log1pl().
void mete0()
{
- volatile double x;
+ double volatile x;
stifle_warning_for_unused_value(x);
x = i_upper_12_over_12_from_i_naive<double>()(0.04);
x = i_from_i_upper_12_over_12_naive<double>()(0.04);
@@ -195,7 +195,7 @@ void mete0()
// This implementation uses production functors.
void mete1()
{
- volatile double x;
+ double volatile x;
stifle_warning_for_unused_value(x);
x = i_upper_12_over_12_from_i<double>()(0.04);
x = i_from_i_upper_12_over_12<double>()(0.04);
diff --git a/mc_enum_types_aux.cpp b/mc_enum_types_aux.cpp
index 59a39c0..5fca9e1 100644
--- a/mc_enum_types_aux.cpp
+++ b/mc_enum_types_aux.cpp
@@ -61,7 +61,7 @@ bool validate_mc_n_values()
/// and Kanze's reply:
/// http://groups.google.com/address@hidden
-volatile bool ensure_setup = validate_mc_n_values();
+bool volatile ensure_setup = validate_mc_n_values();
} // Unnamed namespace.
std::vector<std::string> const& all_strings_gender () {return
all_strings<mcenum_gender >();}
diff --git a/miscellany_test.cpp b/miscellany_test.cpp
index 72e7bf7..ba3c9b6 100644
--- a/miscellany_test.cpp
+++ b/miscellany_test.cpp
@@ -30,10 +30,10 @@
void test_each_equal()
{
- int a0[] {0, 0, 0, 0};
- int const a1[] {0, 1, 1, 1};
- int volatile a2[] {0, 1, 2, 2};
- int const volatile a3[] {0, 1, 2, 3};
+ int a0[] {0, 0, 0, 0};
+ int const a1[] {0, 1, 1, 1};
+ int volatile a2[] {0, 1, 2, 2};
+ int const volatile a3[] {0, 1, 2, 3};
// There can be no volatile standard container.
std::vector<int> v0 {0, 0, 0, 0};
diff --git a/ncnnnpnn_test.cpp b/ncnnnpnn_test.cpp
index 812a91c..3c75819 100644
--- a/ncnnnpnn_test.cpp
+++ b/ncnnnpnn_test.cpp
@@ -133,7 +133,7 @@ int test_main(int, char*[])
_control87(0x00ff, 0x00ff);
#endif // defined __BORLANDC__
- volatile long double d = 0.0;
+ long double volatile d = 0.0;
ncnnnpnn( 1.0 / d );
ncnnnpnn(-1.0 / d );
diff --git a/numeric_io_test.cpp b/numeric_io_test.cpp
index ae9e591..5c4133f 100644
--- a/numeric_io_test.cpp
+++ b/numeric_io_test.cpp
@@ -46,7 +46,7 @@ void test_interconvertibility
)
{
T const v = numeric_io_cast<T>(s);
- volatile bool is_exact = std::numeric_limits<T>::is_exact;
+ bool volatile is_exact = std::numeric_limits<T>::is_exact;
if(is_exact)
{
INVOKE_BOOST_TEST_EQUAL(v, t, file, line);
@@ -102,7 +102,7 @@ static_assert(std::numeric_limits<double>::is_iec559, "");
int test_main(int, char*[])
{
- volatile int z = 0; // Avoid "condition always true/false" warnings.
+ int volatile z = 0; // Avoid "condition always true/false" warnings.
BOOST_TEST_EQUAL( z, floating_point_decimals( 0.0));
BOOST_TEST_EQUAL( z, floating_point_decimals(-0.0));
BOOST_TEST_EQUAL(15, floating_point_decimals( 1.0));
@@ -354,7 +354,7 @@ int test_main(int, char*[])
BOOST_TEST_UNEQUAL("0.1", numeric_io_cast<std::string>(0.1 +
2.2204460492503131e-16));
// 1 +/- epsilon must be formatted as apparent unity.
- volatile bool eq = (1.0 + 2.2204460492503131e-16 ==
1.00000000000000022204460492503131);
+ bool volatile eq = (1.0 + 2.2204460492503131e-16 ==
1.00000000000000022204460492503131);
BOOST_TEST(eq);
BOOST_TEST_EQUAL("1",
numeric_io_cast<std::string>(1.00000000000000022204460492503131));
// Consider:
diff --git a/progress_meter_cgi.cpp b/progress_meter_cgi.cpp
index 6b98637..9477e81 100644
--- a/progress_meter_cgi.cpp
+++ b/progress_meter_cgi.cpp
@@ -84,7 +84,7 @@ std::shared_ptr<progress_meter>
concrete_progress_meter_creator
);
}
-volatile bool ensure_setup = set_progress_meter_creator
+bool volatile ensure_setup = set_progress_meter_creator
(concrete_progress_meter_creator
);
} // Unnamed namespace.
diff --git a/progress_meter_cli.cpp b/progress_meter_cli.cpp
index cc67678..571aa8e 100644
--- a/progress_meter_cli.cpp
+++ b/progress_meter_cli.cpp
@@ -125,7 +125,7 @@ std::shared_ptr<progress_meter>
concrete_progress_meter_creator
);
}
-volatile bool ensure_setup = set_progress_meter_creator
+bool volatile ensure_setup = set_progress_meter_creator
(concrete_progress_meter_creator
);
} // Unnamed namespace.
diff --git a/progress_meter_wx.cpp b/progress_meter_wx.cpp
index 98973d7..f367c9f 100644
--- a/progress_meter_wx.cpp
+++ b/progress_meter_wx.cpp
@@ -152,7 +152,7 @@ std::shared_ptr<progress_meter>
concrete_progress_meter_creator
);
}
-volatile bool ensure_setup = set_progress_meter_creator
+bool volatile ensure_setup = set_progress_meter_creator
(concrete_progress_meter_creator
);
} // Unnamed namespace.
diff --git a/sigfpe.cpp b/sigfpe.cpp
index e8fd82d..b8755d5 100644
--- a/sigfpe.cpp
+++ b/sigfpe.cpp
@@ -56,19 +56,19 @@ void floating_point_error_handler(int)
//
void fpe_handler_test()
{
-// volatile int i0 = 0;
-// volatile int i1 = 1;
-// volatile int i2;
+// int volatile i0 = 0;
+// int volatile i1 = 1;
+// int volatile i2;
//
// CPU Integer divide by zero.
// This one doesn't seem recoverable--handler goes into loop.
// i2 = i1 / i0;
// i2 = i1 % i0;
- volatile double d0 = 0.0;
- volatile double d1 = 1.0;
- volatile double dm = DBL_MAX;
- volatile double d2;
+ double volatile d0 = 0.0;
+ double volatile d1 = 1.0;
+ double volatile dm = DBL_MAX;
+ double volatile d2;
// FPU divide by zero. (Note: 0/0 is invalid operation, not divide by 0.)
d2 = d1 / d0;
diff --git a/system_command_non_wx.cpp b/system_command_non_wx.cpp
index 0dec727..be39bbb 100644
--- a/system_command_non_wx.cpp
+++ b/system_command_non_wx.cpp
@@ -104,6 +104,6 @@ void concrete_system_command(std::string const&
command_line)
#endif // defined LMI_MSW
-volatile bool ensure_setup =
system_command_initialize(concrete_system_command);
+bool volatile ensure_setup =
system_command_initialize(concrete_system_command);
} // Unnamed namespace.
diff --git a/system_command_wx.cpp b/system_command_wx.cpp
index 1e384cd..2fe5fb3 100644
--- a/system_command_wx.cpp
+++ b/system_command_wx.cpp
@@ -124,6 +124,6 @@ void concrete_system_command(std::string const&
command_line)
}
}
-volatile bool ensure_setup =
system_command_initialize(concrete_system_command);
+bool volatile ensure_setup =
system_command_initialize(concrete_system_command);
} // Unnamed namespace.
diff --git a/test_tools_test.cpp b/test_tools_test.cpp
index 80aa973..d48202d 100644
--- a/test_tools_test.cpp
+++ b/test_tools_test.cpp
@@ -26,8 +26,8 @@
#include <iostream>
#include <ostream>
-volatile bool always_true = true;
-volatile bool always_false = false;
+bool volatile always_true = true;
+bool volatile always_false = false;
void test_function(bool a, bool b, char const* file, int line)
{
diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 5737616..fbb5979 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -70,7 +70,7 @@ int test_main(int, char*[])
BOOST_TEST(is_string<std::string const&>::value);
// These tests fail to compile:
-// BOOST_TEST(is_string<std::string volatile>::value);
+// BOOST_TEST(is_string<std::string volatile >::value);
// BOOST_TEST(is_string<std::string const volatile&>::value);
char const* ccp = "2.71828";