public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/libbash:master commit in: src/, /, src/core/, test/, src/builtins/
@ 2011-03-27  8:56 Petteri Räty
  0 siblings, 0 replies; only message in thread
From: Petteri Räty @ 2011-03-27  8:56 UTC (permalink / raw
  To: gentoo-commits

commit:     f116fa1fc2c9882736533d2258bc4479b6c2ce6e
Author:     Petteri Räty <petsku <AT> petteriraty <DOT> eu>
AuthorDate: Sat Mar 26 19:04:00 2011 +0000
Commit:     Petteri Räty <betelgeuse <AT> gentoo <DOT> org>
CommitDate: Sat Mar 26 19:04:00 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=f116fa1f

Enable more warnings for developers

Looked around GCC documentation for more warnings. Not all I found could
be enabled because of apparently false positives.

---
 Makefile.am                     |   10 +++++++++-
 src/builtins/boolean_builtins.h |    4 ++--
 src/builtins/echo_builtin.cpp   |    3 ++-
 src/core/symbols.hpp            |    7 +++----
 src/cppbash_builtin.h           |    3 +++
 test/walker_test.cpp            |    3 ++-
 6 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e424b35..b30ae49 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -58,7 +58,15 @@ COMMON_FLAGS = $(BOOST_CPPFLAGS) -std=c++0x -I$(top_srcdir)/src/
 AM_CFLAGS = -x c++ $(COMMON_FLAGS)
 AM_CXXFLAGS = $(COMMON_FLAGS)
 if DEVELOPER_MODE
-AM_CXXFLAGS += -Wall -Werror
+# -Weffc++ seems to be giving false positives on protected non
+# virtual destructors in base classes
+AM_CXXFLAGS += -Wall \
+			   -Wextra \
+			   -Wold-style-cast \
+			   -Woverloaded-virtual \
+			   -Wsign-promo \
+			   -pedantic-errors \
+			   -Werror
 AM_CPPFLAGS = -D_GLIBCXX_DEBUG
 endif
 

diff --git a/src/builtins/boolean_builtins.h b/src/builtins/boolean_builtins.h
index 68e360d..9b060b1 100644
--- a/src/builtins/boolean_builtins.h
+++ b/src/builtins/boolean_builtins.h
@@ -26,11 +26,11 @@
 struct true_builtin : public virtual cppbash_builtin
 {
   BUILTIN_CONSTRUCTOR(true)
-  virtual int exec(const std::vector<std::string>& bash_args) { return 0; }
+  virtual int exec(const std::vector<std::string>& ) { return 0; }
 };
 
 struct false_builtin : public virtual cppbash_builtin
 {
   BUILTIN_CONSTRUCTOR(false)
-  virtual int exec(const std::vector<std::string>& bash_args) { return 1; }
+  virtual int exec(const std::vector<std::string>& ) { return 1; }
 };

diff --git a/src/builtins/echo_builtin.cpp b/src/builtins/echo_builtin.cpp
index af57b79..28b4d65 100644
--- a/src/builtins/echo_builtin.cpp
+++ b/src/builtins/echo_builtin.cpp
@@ -128,7 +128,8 @@ void echo_builtin::transform_escapes(const std::string &string)
     (
      lit('a')[this->out_buffer() << val("\a")] |
      lit('b')[this->out_buffer() << val("\b")] |
-     lit('e')[this->out_buffer() << val("\e")] |
+     // \e is a GNU extension
+     lit('e')[this->out_buffer() << val("\033")] |
      lit('f')[this->out_buffer() << val("\f")] |
      lit('n')[this->out_buffer() << val("\n")] |
      lit('r')[this->out_buffer() << val("\r")] |

diff --git a/src/core/symbols.hpp b/src/core/symbols.hpp
index dce6e33..bde05fb 100644
--- a/src/core/symbols.hpp
+++ b/src/core/symbols.hpp
@@ -47,10 +47,6 @@ class symbol
   std::string name;
 
 public:
-  symbol(){}
-
-  symbol(const std::string& n): name(n){}
-
   /// \brief retrieve symbol name
   /// \return const string value of symbol name
   const std::string& get_name() const
@@ -58,6 +54,9 @@ public:
     return name;
   }
 
+protected:
+  symbol(const std::string& n): name(n){}
+  ~symbol() {}
 };
 
 ///

diff --git a/src/cppbash_builtin.h b/src/cppbash_builtin.h
index 814358d..29f2fba 100644
--- a/src/cppbash_builtin.h
+++ b/src/cppbash_builtin.h
@@ -49,6 +49,9 @@ class cppbash_builtin
     /// \param instream where to get standard input from.  Default: stdin
     ///
     cppbash_builtin(STREAM_ARGS);
+    /// prevent copying
+    cppbash_builtin(const cppbash_builtin& ) = delete;
+    const cppbash_builtin& operator=( const cppbash_builtin& ) = delete;
 
     virtual ~cppbash_builtin() {};
     ///

diff --git a/test/walker_test.cpp b/test/walker_test.cpp
index 9df0d88..65db3f8 100644
--- a/test/walker_test.cpp
+++ b/test/walker_test.cpp
@@ -64,7 +64,8 @@ public:
 
 void walker_test::init_walker(const char *script){
 
-  input  = antlr3NewAsciiStringInPlaceStream((pANTLR3_UINT8)script,
+  auto start = reinterpret_cast<pANTLR3_UINT8>(const_cast<char *>(script));
+  input  = antlr3NewAsciiStringInPlaceStream(start,
                                              strlen(script),
                                              NULL);
   if ( input == NULL )



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-27  8:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27  8:56 [gentoo-commits] proj/libbash:master commit in: src/, /, src/core/, test/, src/builtins/ Petteri Räty

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox