lilypond-devel
[Top][All Lists]
Advanced

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

Style: disable removal of "gratuitous" blocks. (issue2380041)


From: percival . music . ca
Subject: Style: disable removal of "gratuitous" blocks. (issue2380041)
Date: Wed, 06 Oct 2010 16:55:53 +0000

Reviewers: ,

Message:
Here's two patches (confusingly merged together by git cl :(  that
complete the "make fixcc.py produce compilable files" task.

Description:
Style: disable removal of "gratuitous" blocks.

This rule removed any {} which were around a single statment, but
this removal broke any .h file with short inline function
definitions (such as a "getFoo() { return foo; }").

The templates in flower/include/std-vector.hh were hit
particularly hard by this rule.



Style: clarify "do nothing" macro with {};

This stops fixcc.py from adding a space in
ASSERT_LIVE_IS_ALLOWED()

Please review this at http://codereview.appspot.com/2380041/

Affected files:
  M lily/include/smobs.hh
  M scripts/auxiliar/fixcc.py


Index: lily/include/smobs.hh
diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh
index dc06472890407fb5063293ce86741f9b88b1e25e..999f6cf231ea6c0c18f9782f9cb596c47e5286b1 100644
--- a/lily/include/smobs.hh
+++ b/lily/include/smobs.hh
@@ -162,7 +162,7 @@ extern bool parsed_objects_should_be_dead;
     passed_here_once = true;\
   }
 #else
-#define ASSERT_LIVE_IS_ALLOWED()
+#define ASSERT_LIVE_IS_ALLOWED() {};
 #endif

 #endif /* SMOBS_HH */
Index: scripts/auxiliar/fixcc.py
diff --git a/scripts/auxiliar/fixcc.py b/scripts/auxiliar/fixcc.py
index b77982e2c652ac0ee1ad23649c96945c21593df0..4f74ab94bb6771d2b61b642d5c86603601189785 100755
--- a/scripts/auxiliar/fixcc.py
+++ b/scripts/auxiliar/fixcc.py
@@ -46,9 +46,9 @@ indent_p = 0
 rules = {
     GLOBAL_CXX:
     [
-    # delete gratuitous block
- ('''\n( |\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch| while)\b);\n\s*}''',
-    '\n\\2;'),
+    # delete gratuitous block -- disabled because it breaks .h files
+# ('''\n( |\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch| while)\b);\n\s*}''',
+#    '\n\\2;'),
     ],
     CXX:
     [
@@ -56,9 +56,9 @@ rules = {
     ('([^\( \]])[ \t]*\(', '\\1 ('),
     # space after comma
     ("\([^'],\)[ \t]*", '\1 '),
-    # delete gratuitous block
- ('''\n( |\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch| while)\b);\n\s*}''',
-    '\n\\2;'),
+    # delete gratuitous block -- disabled because it breaks .h files
+# ('''\n( |\t)\s*{\n\s*(.*?)(?![{}]|\b(do|for|else|if|switch| while)\b);\n\s*}''',
+#    '\n\\2;'),
     # delete inline tabs
     ('(\w)\t+', '\\1 '),
     # delete inline double spaces





reply via email to

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