folly: fix mismatched-tags
authorIgor Sugak <sugak@fb.com>
Wed, 13 May 2015 06:40:34 +0000 (23:40 -0700)
committerViswanath Sivakumar <viswanath@fb.com>
Wed, 20 May 2015 17:57:00 +0000 (10:57 -0700)
Summary:
I tried to fix this for default glibc but there are many mismatched-tags inside glibc itself. gcc-4.9-glibc-2.20 does not have such issue, using it.

```lang=bash
% fbconfig --clang --with-project-version clang:dev --extra-cxxflags=-Wmismatched-tags --extra-cxxflags=-ferror-limit=0 --platform-all=gcc-4.9-glibc-2.20-fb -r folly
% fbmake dev -j55 2> err
% perl -n -E 'm/\[-Werror,-Wmismatched-tags\]$/ && print' err | sort -u
./folly/experimental/fibers/TimeoutController.h:52:3: error: 'TimeoutHandle' defined as a struct here but previously declared as a class [-Werror,-Wmismatched-tags]
folly/experimental/fibers/TimeoutController.h:52:3: error: 'TimeoutHandle' defined as a struct here but previously declared as a class [-Werror,-Wmismatched-tags]
folly/experimental/JSONSchema.cpp:65:10: error: class 'ValidationContext' was previously declared as a struct [-Werror,-Wmismatched-tags]
./folly/futures/detail/Core.h:76:1: error: 'Core' defined as a class template here but previously declared as a struct template [-Werror,-Wmismatched-tags]
./folly/futures/Future.h:392:10: error: class 'Promise' was previously declared as a struct [-Werror,-Wmismatched-tags]
./folly/futures/Future.h:45:1: error: 'Future' defined as a class template here but previously declared as a struct template [-Werror,-Wmismatched-tags]
./folly/futures/Future-pre.h:137:1: error: struct 'Timekeeper' was previously declared as a class [-Werror,-Wmismatched-tags]
./folly/futures/Future-pre.h:23:18: error: struct template 'Promise' was previously declared as a class template [-Werror,-Wmismatched-tags]
./folly/futures/Future-pre.h:43:18: error: struct template 'Core' was previously declared as a class template [-Werror,-Wmismatched-tags]
./folly/futures/Promise.h:26:20: error: class template 'Future' was previously declared as a struct template [-Werror,-Wmismatched-tags]
./folly/futures/Timekeeper.h:23:18: error: struct template 'Future' was previously declared as a class template [-Werror,-Wmismatched-tags]
./folly/futures/Timekeeper.h:44:1: error: 'Timekeeper' defined as a class here but previously declared as a struct [-Werror,-Wmismatched-tags]
./folly/Singleton.h:378:10: error: class template 'SingletonHolder' was previously declared as a struct template [-Werror,-Wmismatched-tags]
./folly/wangle/ssl/SSLCacheOptions.h:17:1: error: 'SSLCacheOptions' defined as a struct here but previously declared as a class [-Werror,-Wmismatched-tags]
./folly/wangle/ssl/SSLContextManager.h:29:1: error: class 'SSLCacheOptions' was previously declared as a struct [-Werror,-Wmismatched-tags]
./folly/wangle/ssl/SSLContextManager.h:32:1: error: class 'TLSTicketKeySeeds' was previously declared as a struct [-Werror,-Wmismatched-tags]
% perl -n -E 'm/\[-Werror,-Wmismatched-tags\]$/ && print' err | sort -u | wc -l
16
```

Updated manually. In all cases preferred tag from definition.

Test Plan:
Compile with clang dev and gcc-4.9-glibc-2.20-fb and see fewer errors:
```lang=bash
% fbconfig --clang --with-project-version clang:dev --extra-cxxflags=-Wmismatched-tags --platform-all=gcc-4.9-glibc-2.20-fb -r folly
% fbmake dev -j55
```

Reviewed By: markisaa@fb.com, meyering@fb.com

Subscribers: fugalh, folly-diffs@, jsedgwick, yfeldblum, chalfant

FB internal diff: D2066327

Signature: t1:2066327:1431471232:c65c2827398ba29a4022cc6a5647fac2b3aad717

folly/Singleton.h
folly/experimental/JSONSchema.cpp
folly/experimental/fibers/TimeoutController.h
folly/futures/Future-pre.h
folly/futures/Timekeeper.h
folly/wangle/ssl/SSLContextManager.h

index c9868d4d5385af3feb8b58249bca01e69dbf7313..4a33205c0ff87ad0609be5522fa8b6525dee7223 100644 (file)
@@ -375,7 +375,7 @@ class SingletonVault {
 
  private:
   template <typename T>
-  friend class detail::SingletonHolder;
+  friend struct detail::SingletonHolder;
 
   // The two stages of life for a vault, as mentioned in the class comment.
   enum class SingletonVaultState {
index 5413da3809989c4b4402fa0fdff5003ad3f90594..5297c28e4f4c9e71071eb688f1cc6f0edcaa0740 100644 (file)
@@ -62,7 +62,7 @@ struct IValidator {
   virtual ~IValidator() {}
 
  private:
-  friend class ValidationContext;
+  friend struct ValidationContext;
 
   virtual Optional<SchemaError> validate(ValidationContext&,
                                          const dynamic& value) const = 0;
index f74faeb585177c75e8524bb488347c32b201f377..cd3ce25f6a9964c03778aec010421b86b86f8e52 100644 (file)
@@ -45,7 +45,7 @@ class TimeoutController :
  private:
   void scheduleRun();
 
-  class TimeoutHandle;
+  struct TimeoutHandle;
   typedef std::queue<TimeoutHandle> TimeoutHandleList;
   typedef std::unique_ptr<TimeoutHandleList> TimeoutHandleListPtr;
 
index 70add42af7dcb9a01131f7d7e278a533e6136e17..b7ee7b5c3f4538318897659bc4b25ac1018e706a 100644 (file)
@@ -20,7 +20,7 @@
 
 namespace folly {
 
-template <class> struct Promise;
+template <class> class Promise;
 
 template <typename T>
 struct isFuture : std::false_type {
@@ -40,7 +40,7 @@ struct isTry<Try<T>> : std::true_type {};
 
 namespace detail {
 
-template <class> struct Core;
+template <class> class Core;
 template <class...> struct VariadicContext;
 template <class> struct CollectContext;
 
@@ -134,6 +134,6 @@ struct Extract<R(Class::*)(Args...)> {
 } // detail
 
 
-struct Timekeeper;
+class Timekeeper;
 
 } // namespace
index b9019f289517ccb1524c99e3ffa9ba9bda3f23de..3612f5cf796236d54e8af6bdddc4886f6fcf7147 100644 (file)
@@ -20,7 +20,7 @@
 
 namespace folly {
 
-template <class> struct Future;
+template <class> class Future;
 
 /// A Timekeeper handles the details of keeping time and fulfilling delay
 /// promises. The returned Future<void> will either complete after the
index 01364f02b8210d67fbd5b0c54e5ebf92f021ca62..5877f1d401a3a7b9eecec0ca0c484b5bc95b11ab 100644 (file)
@@ -26,10 +26,10 @@ namespace folly {
 class SocketAddress;
 class SSLContext;
 class ClientHelloExtStats;
-class SSLCacheOptions;
+struct SSLCacheOptions;
 class SSLStats;
 class TLSTicketKeyManager;
-class TLSTicketKeySeeds;
+struct TLSTicketKeySeeds;
 
 class SSLContextManager {
  public: