Files
android_development/vndk/tools/header-checker/src/utils/api_level_test.cpp
Logan Chien e527e061b8 header-checker: Downgrade to C++ 14
This commit switches the option to `-std=c++14` to avoid potential ODR
violations and fix the Mac build.

This commit downgrades from `-std=c++17` to `-std=c++14` because
"llvm/Support/RWMutex.h" from clang-r370808 will use `std::shared_mutex`
when `-std=c++17` is specified but LLVM/Clang prebuilts are built with a
different implementation.

Furthermore, Mac OS X 10.8 (or 10.9) does not support
`std::shared_mutex`.  Thus, there are availability errors when we are
building header-checker for Mac OS X:

    clang-r370808/include/llvm/Support/RWMutex.h:98:8:
    error: 'shared_mutex' is unavailable: introduced in macOS 10.12

Bug: 139945549
Test: OUT_DIR=out && \
      development/vndk/tools/header-checker/android/build-prebuilts.sh

Change-Id: Ic23fbdb67f7cd0700a3001c644485f7d8d0ee3e2
2019-12-09 17:33:21 -08:00

38 lines
1.1 KiB
C++

// Copyright (C) 2019 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "utils/api_level.h"
#include <gtest/gtest.h>
namespace header_checker {
namespace utils {
TEST(ApiLevelTest, ParseApiLevel) {
EXPECT_FALSE(ParseApiLevel(""));
EXPECT_FALSE(ParseApiLevel("A"));
EXPECT_TRUE(ParseApiLevel("current").hasValue());
EXPECT_EQ(FUTURE_API_LEVEL, ParseApiLevel("current").getValue());
EXPECT_TRUE(ParseApiLevel("16").hasValue());
EXPECT_EQ(16l, ParseApiLevel("16").getValue());
}
} // namespace utils
} // namespace header_checker