build: suppress CryptoPP warnings

Change-Id: I52e93fb18c42cf72d73c4477dc4a8093a5221215
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index f0f0482..265259e 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -18,11 +18,6 @@
                         '-Werror',
                         '-Wall',
                         '-fcolor-diagnostics', # only clang supports
-
-                        # to disable known warnings
-                        '-Wno-unused-variable', # cryptopp
-                        '-Wno-unused-function',
-                        '-Wno-deprecated-declarations',
                         ]
 
         if areCustomCxxflagsPresent:
@@ -35,11 +30,6 @@
             conf.add_supported_cxxflags(cxxflags = defaultFlags)
     else:
         defaultFlags = ['-O2', '-g', '-Wall',
-
-                        # to disable known warnings
-                        '-Wno-unused-variable', # cryptopp
-                        '-Wno-unused-function',
-                        '-Wno-deprecated-declarations',
                         ]
         if not areCustomCxxflagsPresent:
             conf.add_supported_cxxflags(cxxflags = defaultFlags)
diff --git a/src/encoding/cryptopp/asn_ext.hpp b/src/encoding/cryptopp/asn_ext.hpp
index b02b3e9..9140ed9 100644
--- a/src/encoding/cryptopp/asn_ext.hpp
+++ b/src/encoding/cryptopp/asn_ext.hpp
@@ -11,7 +11,7 @@
 
 #include <stdexcept>
 #include "../../common.hpp"
-#include <cryptopp/asn.h>
+#include "../../security/cryptopp.hpp"
 
 namespace ndn {
 
diff --git a/src/encoding/oid.cpp b/src/encoding/oid.cpp
index ae4e12d..5f36473 100644
--- a/src/encoding/oid.cpp
+++ b/src/encoding/oid.cpp
@@ -9,7 +9,7 @@
 
 #include "oid.hpp"
 
-#include <cryptopp/asn.h>
+#include "../security/cryptopp.hpp"
 
 using namespace std;
 using namespace CryptoPP;
diff --git a/src/security/certificate-extension.cpp b/src/security/certificate-extension.cpp
index 69a2d10..7ee0de9 100644
--- a/src/security/certificate-extension.cpp
+++ b/src/security/certificate-extension.cpp
@@ -9,7 +9,7 @@
 #include "common.hpp"
 
 #include "certificate-extension.hpp"
-#include <cryptopp/asn.h>
+#include "cryptopp.hpp"
 
 using namespace std;
 using namespace CryptoPP;
diff --git a/src/security/certificate-subject-description.cpp b/src/security/certificate-subject-description.cpp
index ccf6778..fc6478f 100644
--- a/src/security/certificate-subject-description.cpp
+++ b/src/security/certificate-subject-description.cpp
@@ -10,7 +10,7 @@
 
 #include "certificate-subject-description.hpp"
 
-#include <cryptopp/asn.h>
+#include "cryptopp.hpp"
 
 using namespace std;
 using namespace CryptoPP;
diff --git a/src/security/certificate.cpp b/src/security/certificate.cpp
index 931a40e..eb45d6f 100644
--- a/src/security/certificate.cpp
+++ b/src/security/certificate.cpp
@@ -13,9 +13,7 @@
 #include "../util/logging.hpp"
 #include "../util/time.hpp"
 
-#include <cryptopp/asn.h>
-#include <cryptopp/base64.h>
-#include <cryptopp/files.h>
+#include "cryptopp.hpp"
 
 #include "../encoding/cryptopp/asn_ext.hpp"
 
diff --git a/src/security/cryptopp.hpp b/src/security/cryptopp.hpp
new file mode 100644
index 0000000..f22b87e
--- /dev/null
+++ b/src/security/cryptopp.hpp
@@ -0,0 +1,27 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_SECURITY_CRYPTOPP_HPP
+#define NDN_SECURITY_CRYPTOPP_HPP
+
+// suppress CryptoPP warnings
+#pragma GCC system_header
+#pragma clang system_header
+
+#include <cryptopp/asn.h>
+#include <cryptopp/base64.h>
+#include <cryptopp/des.h>
+#include <cryptopp/files.h>
+#include <cryptopp/filters.h>
+#include <cryptopp/hex.h>
+#include <cryptopp/modes.h>
+#include <cryptopp/osrng.h>
+#include <cryptopp/pssr.h>
+#include <cryptopp/pwdbased.h>
+#include <cryptopp/rsa.h>
+#include <cryptopp/sha.h>
+
+#endif // NDN_SECURITY_CRYPTOPP_HPP
diff --git a/src/security/public-key.cpp b/src/security/public-key.cpp
index c8362af..f6b2fdf 100644
--- a/src/security/public-key.cpp
+++ b/src/security/public-key.cpp
@@ -10,9 +10,7 @@
 
 #include "public-key.hpp"
 
-#include <cryptopp/rsa.h>
-#include <cryptopp/base64.h>
-#include <cryptopp/files.h>
+#include "cryptopp.hpp"
 
 using namespace std;
 using namespace CryptoPP;
diff --git a/src/security/sec-tpm-file.cpp b/src/security/sec-tpm-file.cpp
index bb2ad0b..98e117f 100644
--- a/src/security/sec-tpm-file.cpp
+++ b/src/security/sec-tpm-file.cpp
@@ -14,17 +14,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 
-#include <cryptopp/rsa.h>
-#include <cryptopp/files.h>
-#include <cryptopp/base64.h>
-#include <cryptopp/hex.h>
-#include <cryptopp/osrng.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/pssr.h>
-#include <cryptopp/modes.h>
-#include <cryptopp/pwdbased.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/des.h>
+#include "cryptopp.hpp"
 
 #include <sys/types.h>
 #include <sys/stat.h>
diff --git a/src/security/sec-tpm-memory.cpp b/src/security/sec-tpm-memory.cpp
index 5ca9673..6e4a371 100644
--- a/src/security/sec-tpm-memory.cpp
+++ b/src/security/sec-tpm-memory.cpp
@@ -13,7 +13,7 @@
 #include <openssl/ssl.h>
 #include <openssl/sha.h>
 #include <openssl/rsa.h>
-#include <cryptopp/osrng.h>
+#include "cryptopp.hpp"
 
 using namespace std;
 
diff --git a/src/security/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
index 6436b5a..ada0b81 100644
--- a/src/security/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -11,8 +11,7 @@
 
 #include "security/public-key.hpp"
 #include "util/logging.hpp"
-#include <cryptopp/files.h>
-#include <cryptopp/asn.h>
+#include "cryptopp.hpp"
 
 #include <pwd.h>
 #include <unistd.h>
@@ -467,6 +466,8 @@
   keyParams.accessRef = access;
   CFArrayRef outItems;
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
   OSStatus res = SecKeychainItemImport (importedKey,
                                         NULL,
                                         &externalFormat,
@@ -475,6 +476,7 @@
                                         &keyParams,
                                         m_impl->m_keyChainRef,
                                         &outItems);
+#pragma clang diagnostic pop
   
   if(res != errSecSuccess)
     {
diff --git a/src/security/sec-tpm.cpp b/src/security/sec-tpm.cpp
index 56c39b8..e19196c 100644
--- a/src/security/sec-tpm.cpp
+++ b/src/security/sec-tpm.cpp
@@ -7,17 +7,7 @@
 
 #include "sec-tpm.hpp"
 
-#include <cryptopp/rsa.h>
-#include <cryptopp/files.h>
-#include <cryptopp/base64.h>
-#include <cryptopp/hex.h>
-#include <cryptopp/osrng.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/pssr.h>
-#include <cryptopp/modes.h>
-#include <cryptopp/pwdbased.h>
-#include <cryptopp/sha.h>
-#include <cryptopp/des.h>
+#include "cryptopp.hpp"
 
 using namespace std;
 
diff --git a/src/security/validator.cpp b/src/security/validator.cpp
index be166e5..f1d8035 100644
--- a/src/security/validator.cpp
+++ b/src/security/validator.cpp
@@ -12,9 +12,7 @@
 #include "../util/logging.hpp"
 #include "../util/crypto.hpp"
 
-#include <cryptopp/rsa.h>
-#include <cryptopp/files.h>
-#include <cryptopp/hex.h>
+#include "cryptopp.hpp"
 
 
 using namespace std;
diff --git a/src/util/crypto.cpp b/src/util/crypto.cpp
index 3aa114a..1621005 100644
--- a/src/util/crypto.cpp
+++ b/src/util/crypto.cpp
@@ -6,9 +6,7 @@
 #include "../common.hpp"
 
 #include "crypto.hpp"
-#include <cryptopp/sha.h>
-#include <cryptopp/filters.h>
-#include <cryptopp/files.h>
+#include "../security/cryptopp.hpp"
 
 namespace ndn {
 
diff --git a/src/util/io.hpp b/src/util/io.hpp
index 3d39feb..6026f06 100644
--- a/src/util/io.hpp
+++ b/src/util/io.hpp
@@ -13,9 +13,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
-#include <cryptopp/files.h>
-#include <cryptopp/base64.h>
-#include <cryptopp/hex.h>
+#include "../security/cryptopp.hpp"
 
 
 namespace ndn {
diff --git a/src/util/random.cpp b/src/util/random.cpp
index c63e916..db26a3e 100644
--- a/src/util/random.cpp
+++ b/src/util/random.cpp
@@ -8,7 +8,7 @@
 
 #include "random.hpp"
 
-#include <cryptopp/osrng.h>
+#include "../security/cryptopp.hpp"
 
 namespace ndn {
 namespace random {
diff --git a/src/util/regex/regex-component-set-matcher.hpp b/src/util/regex/regex-component-set-matcher.hpp
index 857c59e..4039388 100644
--- a/src/util/regex/regex-component-set-matcher.hpp
+++ b/src/util/regex/regex-component-set-matcher.hpp
@@ -78,8 +78,6 @@
 inline void 
 RegexComponentSetMatcher::compile()
 {
-  int index = 0;
-
   switch(m_expr[0]){
   case '<':
     return compileSingleComponent();
diff --git a/tests-integrated/main.cpp b/tests-integrated/main.cpp
index d43aa5a..10f957c 100644
--- a/tests-integrated/main.cpp
+++ b/tests-integrated/main.cpp
@@ -6,4 +6,13 @@
 #define BOOST_TEST_MAIN 1
 #define BOOST_TEST_DYN_LINK 1
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
+#endif // __clang__
+
 #include <boost/test/unit_test.hpp>
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif // __clang__
diff --git a/tests/main.cpp b/tests/main.cpp
index d43aa5a..10f957c 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -6,4 +6,13 @@
 #define BOOST_TEST_MAIN 1
 #define BOOST_TEST_DYN_LINK 1
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
+#endif // __clang__
+
 #include <boost/test/unit_test.hpp>
+
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif // __clang__
diff --git a/tests/security/identity-fixture.cpp b/tests/security/identity-fixture.cpp
index 1c286e2..899f5de 100644
--- a/tests/security/identity-fixture.cpp
+++ b/tests/security/identity-fixture.cpp
@@ -5,8 +5,18 @@
  */
 
 #include "security/key-chain.hpp"
+
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
+#endif // __clang__
+
 #include <boost/test/unit_test.hpp>
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif // __clang__
+
 namespace ndn {
 
 // OSX KeyChain, when used on a headless server,
diff --git a/tests/security/test-encode-decode-certificate.cpp b/tests/security/test-encode-decode-certificate.cpp
index 3b8cc83..733a9ae 100644
--- a/tests/security/test-encode-decode-certificate.cpp
+++ b/tests/security/test-encode-decode-certificate.cpp
@@ -8,14 +8,7 @@
 #include "security/certificate.hpp"
 #include "security/public-key.hpp"
 
-#if __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wtautological-compare"
-#endif
-
-#include <cryptopp/cryptlib.h>
-#include <cryptopp/rsa.h>
-#include <cryptopp/files.h>
+#include "security/cryptopp.hpp"
 
 #include <fstream>
 #include <boost/test/output_test_stream.hpp>
diff --git a/tests/security/test-sec-tpm-file.cpp b/tests/security/test-sec-tpm-file.cpp
index 70fada8..056fedf 100644
--- a/tests/security/test-sec-tpm-file.cpp
+++ b/tests/security/test-sec-tpm-file.cpp
@@ -4,16 +4,11 @@
  * See COPYING for copyright and distribution information.
  */
 
-#if __clang__
-#pragma clang diagnostic ignored "-Wtautological-compare"
-#endif
-
 #include <boost/test/unit_test.hpp>
 
 #include "security/key-chain.hpp"
 #include "util/time.hpp"
-#include <cryptopp/rsa.h>
-#include <cryptopp/hex.h>
+#include "security/cryptopp.hpp"
 
 using namespace std;
 namespace ndn {
diff --git a/tests/security/test-sec-tpm-osx.cpp b/tests/security/test-sec-tpm-osx.cpp
index a08dc48..941b06d 100644
--- a/tests/security/test-sec-tpm-osx.cpp
+++ b/tests/security/test-sec-tpm-osx.cpp
@@ -4,17 +4,11 @@
  * See COPYING for copyright and distribution information.
  */
 
-#if __clang__
-#pragma clang diagnostic ignored "-Wtautological-compare"
-#endif
-
 #include <boost/test/unit_test.hpp>
 
 #include "security/key-chain.hpp"
 #include "util/time.hpp"
-#include <cryptopp/rsa.h>
-#include <cryptopp/files.h>
-#include <cryptopp/hex.h>
+#include "security/cryptopp.hpp"
 
 using namespace std;
 namespace ndn {
diff --git a/tests/security/test-signature-sha256.cpp b/tests/security/test-signature-sha256.cpp
index bb1b756..daf359b 100644
--- a/tests/security/test-signature-sha256.cpp
+++ b/tests/security/test-signature-sha256.cpp
@@ -9,9 +9,7 @@
 #include "security/key-chain.hpp"
 #include "security/validator.hpp"
 
-#include <cryptopp/base64.h>
-#include <cryptopp/hex.h>
-#include <cryptopp/files.h>
+#include "security/cryptopp.hpp"
 
 using namespace std;
 namespace ndn {
diff --git a/tests/test-data.cpp b/tests/test-data.cpp
index 19241b5..0034ffa 100644
--- a/tests/test-data.cpp
+++ b/tests/test-data.cpp
@@ -10,9 +10,7 @@
 
 #include <fstream>
 
-#include <cryptopp/rsa.h>
-#include <cryptopp/osrng.h>
-#include <cryptopp/files.h>
+#include "security/cryptopp.hpp"
 
 using namespace std;
 namespace ndn {
@@ -170,7 +168,6 @@
   
   RSASS<PKCS1v15, SHA256>::Signer signer(privateKey_);
 
-  int i = 0;
   PK_MessageAccumulator *hash = signer.NewSignatureAccumulator(rng_);
   hash->Update(d.getName().    wireEncode().wire(), d.getName().    wireEncode().size());
   hash->Update(d.getMetaInfo().wireEncode().wire(), d.getMetaInfo().wireEncode().size());
diff --git a/tools/ndnsec-util.hpp b/tools/ndnsec-util.hpp
index 0934d90..afc393a 100644
--- a/tools/ndnsec-util.hpp
+++ b/tools/ndnsec-util.hpp
@@ -22,8 +22,7 @@
 #include <boost/exception/all.hpp>
 
 
-#include <cryptopp/base64.h>
-#include <cryptopp/files.h>
+#include "security/cryptopp.hpp"
 
 #include "security/key-chain.hpp"
 #include "util/io.hpp"