Summary:
Without this change, any folly-using project that attempts to enable
gcc's -Wshadow option will be overwhelmed by warnings about violations
in folly's class definitions. Violations are often due to local
variable or parameter names shadowed by a member function.
Bracket offending content with directives like this:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
...
#pragma GCC diagnostic pop
This set of modified files is the minimal set to allow tao
to use -Wshadow with no folly-related warning.
Test Plan:
fbmake folly/test && fbmake opt
Reviewed By: simpkins@fb.com
FB internal diff:
D848455
#include <limits>
#include <type_traits>
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
#ifdef _LIBSTDCXX_FBSTRING
namespace std _GLIBCXX_VISIBILITY(default) {
_GLIBCXX_BEGIN_NAMESPACE_VERSION
} // namespace folly
+#pragma GCC diagnostic pop
+
#ifndef _LIBSTDCXX_FBSTRING
namespace std {
#include "folly/small_vector.h"
#include "folly/FormatArg.h"
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace folly {
// forward declarations
#include "folly/Format-inl.h"
-#endif /* FOLLY_FORMAT_H_ */
+#pragma GCC diagnostic pop
+#endif /* FOLLY_FORMAT_H_ */
#include "folly/Traits.h"
#include "folly/Likely.h"
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace folly {
template <class T> class Range;
}
} // !namespace folly
+#pragma GCC diagnostic pop
+
FOLLY_ASSUME_FBVECTOR_COMPATIBLE_1(folly::Range);
#endif // FOLLY_RANGE_H_
* limitations under the License.
*/
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace folly { namespace gen {
/**
}
}} //folly::gen
+
+#pragma GCC diagnostic pop
#include "folly/Range.h"
#include "folly/FBVector.h"
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace folly {
/**
} // folly
+#pragma GCC diagnostic pop
+
#endif // FOLLY_IO_IOBUF_H_
# endif
#endif
+// Ignore shadowing warnings within this file, so includers can use -Wshadow.
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wshadow"
+
namespace folly {
//////////////////////////////////////////////////////////////////////
}
+#pragma GCC diagnostic pop
+
#ifdef FB_PACKED
# undef FB_PACKED
#endif