bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

c ++: also prefer YY_ASSERT to YYASSERT


From: Akim Demaille
Subject: c ++: also prefer YY_ASSERT to YYASSERT
Date: Sat, 7 Dec 2019 10:56:47 +0100

commit 3e7a258726dbd9a13691965d46f8c30c951a21e8
Author: Akim Demaille <address@hidden>
Date:   Sat Dec 7 09:49:22 2019 +0100

    c++: also prefer YY_ASSERT to YYASSERT
    
    Like the other skeletons.
    
    * data/skeletons/variant.hh: here.

diff --git a/data/skeletons/variant.hh b/data/skeletons/variant.hh
index 8b9d4802..be4a3ce7 100644
--- a/data/skeletons/variant.hh
+++ b/data/skeletons/variant.hh
@@ -72,9 +72,9 @@ m4_map([      b4_symbol_tag_comment], [$@])dnl
 # The needed includes for variants support.
 m4_define([b4_variant_includes],
 [b4_parse_assert_if([[#include <typeinfo>]])[
-#ifndef YYASSERT
+#ifndef YY_ASSERT
 # include <cassert>
-# define YYASSERT assert
+# define YY_ASSERT assert
 #endif
 ]])
 
@@ -111,14 +111,14 @@ m4_define([b4_value_type_declare],
     semantic_type (YY_RVREF (T) t)]b4_parse_assert_if([
       : yytypeid_ (&typeid (T))])[
     {
-      YYASSERT (sizeof (T) <= size);
+      YY_ASSERT (sizeof (T) <= size);
       new (yyas_<T> ()) T (YY_MOVE (t));
     }
 
     /// Destruction, allowed only if empty.
     ~semantic_type () YY_NOEXCEPT
     {]b4_parse_assert_if([
-      YYASSERT (!yytypeid_);
+      YY_ASSERT (!yytypeid_);
     ])[}
 
 # if 201103L <= YY_CPLUSPLUS
@@ -127,8 +127,8 @@ m4_define([b4_value_type_declare],
     T&
     emplace (U&&... u)
     {]b4_parse_assert_if([
-      YYASSERT (!yytypeid_);
-      YYASSERT (sizeof (T) <= size);
+      YY_ASSERT (!yytypeid_);
+      YY_ASSERT (sizeof (T) <= size);
       yytypeid_ = & typeid (T);])[
       return *new (yyas_<T> ()) T (std::forward <U>(u)...);
     }
@@ -138,8 +138,8 @@ m4_define([b4_value_type_declare],
     T&
     emplace ()
     {]b4_parse_assert_if([
-      YYASSERT (!yytypeid_);
-      YYASSERT (sizeof (T) <= size);
+      YY_ASSERT (!yytypeid_);
+      YY_ASSERT (sizeof (T) <= size);
       yytypeid_ = & typeid (T);])[
       return *new (yyas_<T> ()) T ();
     }
@@ -149,8 +149,8 @@ m4_define([b4_value_type_declare],
     T&
     emplace (const T& t)
     {]b4_parse_assert_if([
-      YYASSERT (!yytypeid_);
-      YYASSERT (sizeof (T) <= size);
+      YY_ASSERT (!yytypeid_);
+      YY_ASSERT (sizeof (T) <= size);
       yytypeid_ = & typeid (T);])[
       return *new (yyas_<T> ()) T (t);
     }
@@ -179,9 +179,9 @@ m4_define([b4_value_type_declare],
     T&
     as () YY_NOEXCEPT
     {]b4_parse_assert_if([
-      YYASSERT (yytypeid_);
-      YYASSERT (*yytypeid_ == typeid (T));
-      YYASSERT (sizeof (T) <= size);])[
+      YY_ASSERT (yytypeid_);
+      YY_ASSERT (*yytypeid_ == typeid (T));
+      YY_ASSERT (sizeof (T) <= size);])[
       return *yyas_<T> ();
     }
 
@@ -190,9 +190,9 @@ m4_define([b4_value_type_declare],
     const T&
     as () const YY_NOEXCEPT
     {]b4_parse_assert_if([
-      YYASSERT (yytypeid_);
-      YYASSERT (*yytypeid_ == typeid (T));
-      YYASSERT (sizeof (T) <= size);])[
+      YY_ASSERT (yytypeid_);
+      YY_ASSERT (*yytypeid_ == typeid (T));
+      YY_ASSERT (sizeof (T) <= size);])[
       return *yyas_<T> ();
     }
 
@@ -208,8 +208,8 @@ m4_define([b4_value_type_declare],
     void
     swap (self_type& that) YY_NOEXCEPT
     {]b4_parse_assert_if([
-      YYASSERT (yytypeid_);
-      YYASSERT (*yytypeid_ == *that.yytypeid_);])[
+      YY_ASSERT (yytypeid_);
+      YY_ASSERT (*yytypeid_ == *that.yytypeid_);])[
       std::swap (as<T> (), that.as<T> ());
     }
 
@@ -401,7 +401,7 @@ m4_define([_b4_token_constructor_define],
                               b4_symbol_if([$1], [has_type], [std::move (v)]),
                               b4_locations_if([std::move (l)]))[)
       {
-        YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], 
[$@]))[);
+        YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], 
[$@]))[);
       }
 #else
       symbol_type (]b4_join(
@@ -413,7 +413,7 @@ m4_define([_b4_token_constructor_define],
                               b4_symbol_if([$1], [has_type], [v]),
                               b4_locations_if([l]))[)
       {
-        YYASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], 
[$@]))[);
+        YY_ASSERT (]m4_join([ || ], m4_map_sep([_b4_type_clause], [, ], 
[$@]))[);
       }
 #endif
 ]])])




reply via email to

[Prev in Thread] Current Thread [Next in Thread]