diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 927554c..b740ed9 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'] += ['-pedantic', '-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'] += ['-pedantic', '-Wall', '-O2', '-g']
+        flags['CXXFLAGS'] += ['-pedantic',
+                              '-Wall',
+                              '-O2',
+                              '-g',
+                              ]
         return flags
 
 class GccFlags(GccBasicFlags):
@@ -130,23 +136,35 @@
         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',
-                              '-Wno-error=unused-local-typedef', # Bug #2657
-                              ]
-        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',
+                              ]
+        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
