# Copyright (c) 2022 Huawei Device Co., Ltd. # 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. config("rtti") { if (is_win) { cflags_cc = [ "/GR" ] } else { cflags_cc = [ "-frtti" ] } } config("exceptions") { if (is_win) { # Enables exceptions in the STL. if (!use_custom_libcxx) { defines = [ "_HAS_EXCEPTIONS=1" ] } cflags_cc = [ "/EHsc" ] } else { cflags_cc = [ "-fexceptions" ] } } config("no_exceptions") { if (is_win) { # Disables exceptions in the STL. # libc++ uses the __has_feature macro to control whether to use exceptions, # so defining this macro is unnecessary. Defining _HAS_EXCEPTIONS to 0 also # breaks libc++ because it depends on MSVC headers that only provide certain # declarations if _HAS_EXCEPTIONS is 1. Those MSVC headers do not use # exceptions, despite being conditional on _HAS_EXCEPTIONS. if (!use_custom_libcxx) { defines = [ "_HAS_EXCEPTIONS=0" ] } } else { cflags_cc = [ "-fno-exceptions" ] } }