Reviewers: jkummerow,

Message:
A valid static assert in the form STATIC_ASSERT( a < b )  would result in
compile failures similar to this:

../src/ia32/code-stubs-ia32.cc: In member function ‘virtual void
v8::internal::RegExpExecStub::Generate(v8::internal::MacroAssembler*)’:
../src/ia32/code-stubs-ia32.cc:3400: error: parse error in template argument
list
../src/ia32/code-stubs-ia32.cc:3400: error: template argument 1 is invalid
cc1plus: warnings being treated as errors
../src/ia32/code-stubs-ia32.cc:3400: error: ‘typedef’ was ignored in this
declaration


Description:
Small fix for STATIC_ASSERT.


Please review this at http://codereview.chromium.org/7776007/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/arm/code-stubs-arm.cc
  M src/checks.h
  M src/ia32/code-stubs-ia32.cc
  M src/mips/code-stubs-mips.cc
  M src/x64/code-stubs-x64.cc


Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index ffe32bc60a46b1d50fbddd2e8192d86967bd928a..09d2c170c2e85b8bc7f3f0e58fcda7e1be6454b1 100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -4389,8 +4389,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
   // a sequential string or an external string.
// In the case of a sliced string its offset has to be taken into account.
   Label cons_string, check_encoding;
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmp(r1, Operand(kExternalStringTag));
   __ b(lt, &cons_string);
   __ b(eq, &runtime);
@@ -4857,8 +4857,8 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {

   // Handle non-flat strings.
   __ and_(result_, result_, Operand(kStringRepresentationMask));
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmp(result_, Operand(kExternalStringTag));
   __ b(gt, &sliced_string);
   __ b(eq, &call_runtime_);
Index: src/checks.h
diff --git a/src/checks.h b/src/checks.h
index a560b2fb1524e2a207c6fe4c3a90a4f7eb9f3d60..2f359f6cd84efdd30f82ab6568a95657c6754edc 100644
--- a/src/checks.h
+++ b/src/checks.h
@@ -251,9 +251,9 @@ template <> class StaticAssertion<true> { };
 // actually causes each use to introduce a new defined type with a
 // name depending on the source line.
 template <int> class StaticAssertionHelper { };
-#define STATIC_CHECK(test) \ - typedef \ - StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>(test)>)> \ +#define STATIC_CHECK(test) \ + typedef \ + StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
     SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__)


Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index d76e4bf1f444a40f4021827d747738cd21bd7d53..4f205eb6cd7147b175bb3c85efa446699d3aae57 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -3396,8 +3396,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
   // a sequential string or an external string.
// In the case of a sliced string its offset has to be taken into account.
   Label cons_string, check_encoding;
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmp(Operand(ebx), Immediate(kExternalStringTag));
   __ j(less, &cons_string);
   __ j(equal, &runtime);
@@ -4872,8 +4872,8 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {

   // Handle non-flat strings.
   __ and_(result_, kStringRepresentationMask);
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmp(result_, kExternalStringTag);
   __ j(greater, &sliced_string, Label::kNear);
   __ j(equal, &call_runtime_);
Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 2526a6a28b203bfaa1703403c388bc2131962e2b..5f4c9b4e41117133ced7a89d1f59e4d217e22ebd 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -4541,8 +4541,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
   // a sequential string or an external string.
// In the case of a sliced string its offset has to be taken into account.
   Label cons_string, check_encoding;
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ Branch(&cons_string, lt, at, Operand(kExternalStringTag));
   __ Branch(&runtime, eq, at, Operand(kExternalStringTag));

@@ -5025,8 +5025,8 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {

   // Handle non-flat strings.
   __ And(result_, result_, Operand(kStringRepresentationMask));
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ Branch(&sliced_string, gt, result_, Operand(kExternalStringTag));
   __ Branch(&call_runtime_, eq, result_, Operand(kExternalStringTag));

Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index 0b785c5dd6b02c2f0d582938d5f0bdbfb1f22251..9237a0a36496a813e7fff686798621bfaa39e6b4 100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -2470,8 +2470,8 @@ void RegExpExecStub::Generate(MacroAssembler* masm) {
   // a sequential string or an external string.
// In the case of a sliced string its offset has to be taken into account.
   Label cons_string, check_encoding;
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmpq(rbx, Immediate(kExternalStringTag));
   __ j(less, &cons_string, Label::kNear);
   __ j(equal, &runtime);
@@ -3903,8 +3903,8 @@ void StringCharCodeAtGenerator::GenerateFast(MacroAssembler* masm) {

   // Handle non-flat strings.
   __ and_(result_, Immediate(kStringRepresentationMask));
-  STATIC_ASSERT((kConsStringTag < kExternalStringTag));
-  STATIC_ASSERT((kSlicedStringTag > kExternalStringTag));
+  STATIC_ASSERT(kConsStringTag < kExternalStringTag);
+  STATIC_ASSERT(kSlicedStringTag > kExternalStringTag);
   __ cmpb(result_, Immediate(kExternalStringTag));
   __ j(greater, &sliced_string);
   __ j(equal, &call_runtime_);


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to