[llvm-commits] [compiler-rt] r168992 - in /compiler-rt/trunk/lib/asan/tests: asan_test.cc asan_test_config.h asan_test_utils.h

Alexey Samsonov samsonov at google.com
Fri Nov 30 09:46:53 PST 2012


On Fri, Nov 30, 2012 at 2:41 AM, Kostya Serebryany <kcc at google.com> wrote:

> Author: kcc
> Date: Fri Nov 30 04:41:42 2012
> New Revision: 168992
>
> URL: http://llvm.org/viewvc/llvm-project?rev=168992&view=rev
> Log:
> [asan] make asan_test.cc more gcc-friendly
>
> Modified:
>     compiler-rt/trunk/lib/asan/tests/asan_test.cc
>     compiler-rt/trunk/lib/asan/tests/asan_test_config.h
>     compiler-rt/trunk/lib/asan/tests/asan_test_utils.h
>
> Modified: compiler-rt/trunk/lib/asan/tests/asan_test.cc
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test.cc?rev=168992&r1=168991&r2=168992&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/asan_test.cc (original)
> +++ compiler-rt/trunk/lib/asan/tests/asan_test.cc Fri Nov 30 04:41:42 2012
> @@ -129,6 +129,8 @@
>  TEST(AddressSanitizer, HasFeatureAddressSanitizerTest) {
>  #if defined(__has_feature) && __has_feature(address_sanitizer)
>    bool asan = 1;
> +#elif defined(__SANITIZE_ADDRESS__)
> +  bool asan = 1;
>  #else
>    bool asan = 0;
>  #endif
> @@ -974,6 +976,7 @@
>    size_t length = Ident(10);
>    char *heap_string = Ident((char*)malloc(length + 1));
>    char stack_string[10 + 1];
> +  break_optimization(&stack_string);
>    for (size_t i = 0; i < length; i++) {
>      heap_string[i] = 'a';
>      stack_string[i] = 'b';
>
> Modified: compiler-rt/trunk/lib/asan/tests/asan_test_config.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test_config.h?rev=168992&r1=168991&r2=168992&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/asan_test_config.h (original)
> +++ compiler-rt/trunk/lib/asan/tests/asan_test_config.h Fri Nov 30
> 04:41:42 2012
> @@ -21,7 +21,11 @@
>  #include <string>
>  #include <map>
>
> -#include "gtest/gtest.h"
> +#if ASAN_USE_DEJAGNU_GTEST
> +# include "dejagnu-gtest.h"
> +#else
> +# include "gtest/gtest.h"
> +#endif
>

Just in case, you may also use -DASAN_EXTERNAL_TEST_CONFIG
and "-include asan_gcc_config_test_config.h"



>
>  using std::string;
>  using std::vector;
>
> Modified: compiler-rt/trunk/lib/asan/tests/asan_test_utils.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_test_utils.h?rev=168992&r1=168991&r2=168992&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/asan/tests/asan_test_utils.h (original)
> +++ compiler-rt/trunk/lib/asan/tests/asan_test_utils.h Fri Nov 30 04:41:42
> 2012
> @@ -40,7 +40,7 @@
>  #define __has_feature(x) 0
>  #endif
>
> -#if __has_feature(address_sanitizer)
> +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
>  # define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \
>      __attribute__((no_address_safety_analysis))
>  #else
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



-- 
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121130/894a02b5/attachment.html>


More information about the llvm-commits mailing list