diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index dd78c1c..f82fe10 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -14,22 +14,21 @@
         flags = ClangFlags()
     else:
         flags = CompilerFlags()
-        Logs.warn('The code has not been yet tested with %s compiler' % cxx)
+        Logs.warn('The code has not yet been tested with %s compiler' % cxx)
 
     areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
 
-    # General flags will alway be applied (e.g., selecting C++11 mode)
+    # General flags are always applied (e.g., selecting C++11 mode)
     generalFlags = flags.getGeneralFlags(conf)
     conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
     conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
     conf.env.DEFINES += generalFlags['DEFINES']
 
-    # Debug or optimization CXXFLAGS and LINKFLAGS  will be applied only if the
+    # Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
     # corresponding environment variables are not set.
-    # DEFINES will be always applied
+    # DEFINES are always applied.
     if conf.options.debug:
         extraFlags = flags.getDebugFlags(conf)
-
         if areCustomCxxflagsPresent:
             missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS]
             if len(missingFlags) > 0:
@@ -96,20 +95,27 @@
         return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': ['NDEBUG']}
 
 class GccBasicFlags(CompilerFlags):
-    """This class defines base flags that work for gcc and clang compiler"""
+    """
+    This class defines basic flags that work for both gcc and clang compilers
+    """
     def getDebugFlags(self, conf):
         flags = super(GccBasicFlags, self).getDebugFlags(conf)
-        flags['CXXFLAGS'] += ['-Wall',
+        flags['CXXFLAGS'] += ['-pedantic',
+                              '-Wall',
                               '-O0',
                               '-g3',
                               '-Werror',
                               '-Wno-error=maybe-uninitialized', # Bug #1615
-                             ]
+                              ]
         return flags
 
     def getOptimizedFlags(self, conf):
         flags = super(GccBasicFlags, self).getOptimizedFlags(conf)
-        flags['CXXFLAGS'] += ['-Wall', '-O2', '-g']
+        flags['CXXFLAGS'] += ['-pedantic',
+                              '-Wall',
+                              '-O2',
+                              '-g',
+                              ]
         return flags
 
 class GccFlags(GccBasicFlags):
@@ -124,28 +130,44 @@
             flags['CXXFLAGS'] += ['-std=c++0x']
         else:
             flags['CXXFLAGS'] += ['-std=c++11']
+        if version < (4, 8, 0):
+            flags['DEFINES'] += ['_GLIBCXX_USE_NANOSLEEP'] # Bug #2499
         return flags
 
     def getDebugFlags(self, conf):
         flags = super(GccFlags, self).getDebugFlags(conf)
         flags['CXXFLAGS'] += ['-Og', # gcc >= 4.8
                               '-fdiagnostics-color', # gcc >= 4.9
-                             ]
+                              ]
+        return flags
+
+    def getOptimizedFlags(self, conf):
+        flags = super(GccFlags, self).getOptimizedFlags(conf)
+        flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
         return flags
 
 class ClangFlags(GccBasicFlags):
     def getGeneralFlags(self, conf):
         flags = super(ClangFlags, self).getGeneralFlags(conf)
-        flags['CXXFLAGS'] += ['-std=c++11',
-                              '-Wno-error=unneeded-internal-declaration', # Bug #1588
-                              '-Wno-error=deprecated-register',
-                              ]
-        if Utils.unversioned_sys_platform() == "darwin":
+        flags['CXXFLAGS'] += ['-std=c++11']
+        if Utils.unversioned_sys_platform() == 'darwin':
             flags['CXXFLAGS'] += ['-stdlib=libc++']
             flags['LINKFLAGS'] += ['-stdlib=libc++']
         return flags
 
     def getDebugFlags(self, conf):
         flags = super(ClangFlags, self).getDebugFlags(conf)
-        flags['CXXFLAGS'] += ['-fcolor-diagnostics']
+        flags['CXXFLAGS'] += ['-fcolor-diagnostics',
+                              '-Wno-unused-local-typedef', # Bugs #2657 and #3209
+                              '-Wno-error=unneeded-internal-declaration', # Bug #1588
+                              '-Wno-error=deprecated-register',
+                              '-Wno-error=keyword-macro', # Bug #3235
+                              ]
+        return flags
+
+    def getOptimizedFlags(self, conf):
+        flags = super(ClangFlags, self).getOptimizedFlags(conf)
+        flags['CXXFLAGS'] += ['-fcolor-diagnostics',
+                              '-Wno-unused-local-typedef', # Bugs #2657 and #3209
+                              ]
         return flags
