build: downgrade maybe-uninitialized from an error to a warning

maybe-uninitialized has false positives in gcc 4.8 due to
Boost ticket #9134 https://svn.boost.org/trac/boost/ticket/9134

refs #1560

Change-Id: I44e2456b31f3a102d4a447da0dc81c23efb31f3b
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index 741791e..0df0347 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -30,7 +30,8 @@
                          '-g3',
                          '-fcolor-diagnostics', # clang
                          '-fdiagnostics-color', # gcc >= 4.9
-                         '-Werror'
+                         '-Werror',
+                         '-Wno-error=maybe-uninitialized', # Bug #1560
                         ]
         if areCustomCxxflagsPresent:
             missingFlags = [x for x in defaultFlags if x not in conf.env.CXXFLAGS]
diff --git a/tools/nfdc.cpp b/tools/nfdc.cpp
index bb60fef..729dcb8 100644
--- a/tools/nfdc.cpp
+++ b/tools/nfdc.cpp
@@ -402,11 +402,9 @@
     return 0;
   }
 
-
+  ::optind = 2; //start reading options from 2nd argument i.e. Command
   int opt;
-  //start reading options from 2nd argument i.e. Command
-  optind=2;
-  while ((opt = getopt(argc, argv, "ICc:")) != -1) {
+  while ((opt = ::getopt(argc, argv, "ICc:")) != -1) {
     switch (opt) {
     case 'I':
       p.m_flags =  p.m_flags & ~(nfdc::ROUTE_FLAG_CHILD_INHERIT);
@@ -418,27 +416,28 @@
 
     case 'c':
       try {
-        p.m_cost =  boost::lexical_cast<int>(optarg);
+        p.m_cost = boost::lexical_cast<int>(::optarg);
       }
-      catch (const std::exception& e) {
+      catch (boost::bad_lexical_cast&) {
         std::cerr << "Error: cost must be in integer format" << std::endl;
         return 1;
       }
       break;
+
     default:
       usage(p.m_programName);
       return 1;
     }
   }
 
-  if (argc == optind) {
+  if (argc == ::optind) {
     usage(p.m_programName);
     return 1;
   }
 
   try {
-    p.m_commandLineArguments = const_cast<const char**>(argv + optind);
-    p.m_nOptions = argc - optind;
+    p.m_commandLineArguments = argv + ::optind;
+    p.m_nOptions = argc - ::optind;
 
     //argv[1] points to the command, so pass it to the dispatch
     bool isOk = p.dispatch(argv[1]);
diff --git a/tools/nfdc.hpp b/tools/nfdc.hpp
index 8734e42..787ca26 100644
--- a/tools/nfdc.hpp
+++ b/tools/nfdc.hpp
@@ -176,7 +176,7 @@
   const char* m_programName;
 
   // command parameters without leading 'cmd' component
-  const char** m_commandLineArguments;
+  const char* const* m_commandLineArguments;
   int m_nOptions;
   uint64_t m_flags;
   uint64_t m_cost;