From dc6cfb04ebf1ab5917cef0136f9fb342dfc421fd Mon Sep 17 00:00:00 2001 From: Philip Pronin Date: Mon, 14 Jan 2013 15:54:13 -0800 Subject: [PATCH] fix some of the warning/errors clang 3.1 reports - 2 Test Plan: fbconfig -r folly && fbmake opt -j32 to make sure gcc is still able to compile it Reviewed By: tudorb@fb.com FB internal diff: D678500 --- folly/AtomicHashMap.h | 4 ++-- .../exception_tracer/ExceptionTracer.h | 5 +++-- .../exception_tracer/ExceptionTracerLib.cpp | 18 ++++++++++-------- folly/experimental/test/GenTest.cpp | 6 +++--- folly/test/DynamicConverterTest.cpp | 5 ++++- 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/folly/AtomicHashMap.h b/folly/AtomicHashMap.h index bc95bbd6..5de4f503 100644 --- a/folly/AtomicHashMap.h +++ b/folly/AtomicHashMap.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Facebook, Inc. + * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -394,7 +394,7 @@ class AtomicHashMap : boost::noncopyable { SimpleRetT findInternal(const KeyT k) const; - SimpleRetT findAtInternal(const uint32_t idx) const; + SimpleRetT findAtInternal(uint32_t idx) const; std::atomic subMaps_[kNumSubMaps_]; std::atomic numMapsAllocated_; diff --git a/folly/experimental/exception_tracer/ExceptionTracer.h b/folly/experimental/exception_tracer/ExceptionTracer.h index ded9a191..84800bf3 100644 --- a/folly/experimental/exception_tracer/ExceptionTracer.h +++ b/folly/experimental/exception_tracer/ExceptionTracer.h @@ -1,5 +1,5 @@ /* - * Copyright 2012 Facebook, Inc. + * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,9 @@ #ifndef FOLLY_EXPERIMENTAL_EXCEPTION_TRACER_EXCEPTIONTRACER_H_ #define FOLLY_EXPERIMENTAL_EXCEPTION_TRACER_EXCEPTIONTRACER_H_ -#include #include +#include +#include namespace folly { namespace exception_tracer { diff --git a/folly/experimental/exception_tracer/ExceptionTracerLib.cpp b/folly/experimental/exception_tracer/ExceptionTracerLib.cpp index 78889821..2a7c954b 100644 --- a/folly/experimental/exception_tracer/ExceptionTracerLib.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracerLib.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Facebook, Inc. + * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,6 @@ * limitations under the License. */ - #include #include #include @@ -45,19 +44,22 @@ __thread StackTraceStack* caughtExceptions; pthread_once_t initialized = PTHREAD_ONCE_INIT; extern "C" { -typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void)); +typedef void (*CxaThrowType)(void*, std::type_info*, void (*)(void)) + __attribute__((noreturn)); typedef void* (*CxaBeginCatchType)(void*); -typedef void (*CxaRethrowType)(void); +typedef void (*CxaRethrowType)(void) + __attribute__((noreturn)); typedef void (*CxaEndCatchType)(void); -CxaThrowType orig_cxa_throw __attribute__((noreturn)); +CxaThrowType orig_cxa_throw; CxaBeginCatchType orig_cxa_begin_catch; -CxaRethrowType orig_cxa_rethrow __attribute__((noreturn)); +CxaRethrowType orig_cxa_rethrow; CxaEndCatchType orig_cxa_end_catch; } // extern "C" -typedef void (*RethrowExceptionType)(std::exception_ptr); -RethrowExceptionType orig_rethrow_exception __attribute__((noreturn)); +typedef void (*RethrowExceptionType)(std::exception_ptr) + __attribute__((noreturn)); +RethrowExceptionType orig_rethrow_exception; void initialize() { orig_cxa_throw = (CxaThrowType)dlsym(RTLD_NEXT, "__cxa_throw"); diff --git a/folly/experimental/test/GenTest.cpp b/folly/experimental/test/GenTest.cpp index 284a2c09..de2e4afb 100644 --- a/folly/experimental/test/GenTest.cpp +++ b/folly/experimental/test/GenTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Facebook, Inc. + * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -251,8 +251,8 @@ TEST(Gen, OrderTake) { TEST(Gen, MinBy) { EXPECT_EQ(7, seq(1, 10) - | minBy([](int i) { - auto d = i - 6.8; + | minBy([](int i) -> double { + double d = i - 6.8; return d * d; })); } diff --git a/folly/test/DynamicConverterTest.cpp b/folly/test/DynamicConverterTest.cpp index 47e87dc0..83c95b18 100644 --- a/folly/test/DynamicConverterTest.cpp +++ b/folly/test/DynamicConverterTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Facebook, Inc. + * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ // @author Nicholas Ormrod #include "folly/DynamicConverter.h" + +#include #include #include #include "folly/Benchmark.h" @@ -143,6 +145,7 @@ TEST(DynamicConverter, map_keyed_by_string) { TEST(DynamicConverter, map_to_vector_of_pairs) { dynamic d1 = dynamic::object("1", "one")("2", "two"); auto i1 = convertTo>>(d1); + std::sort(i1.begin(), i1.end()); decltype(i1) i1b = { { "1", "one" }, { "2", "two" } }; EXPECT_EQ(i1, i1b); } -- 2.34.1