当前位置: 首页>>代码示例>>Python>>正文


Python CXXCompiler.addWarningFlagIfSupported方法代码示例

本文整理汇总了Python中libcxx.compiler.CXXCompiler.addWarningFlagIfSupported方法的典型用法代码示例。如果您正苦于以下问题:Python CXXCompiler.addWarningFlagIfSupported方法的具体用法?Python CXXCompiler.addWarningFlagIfSupported怎么用?Python CXXCompiler.addWarningFlagIfSupported使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在libcxx.compiler.CXXCompiler的用法示例。


在下文中一共展示了CXXCompiler.addWarningFlagIfSupported方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Configuration

# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import addWarningFlagIfSupported [as 别名]

#.........这里部分代码省略.........
        if use_color is None:
            use_color = os.environ.get('LIBCXX_COLOR_DIAGNOSTICS')
        if use_color is None:
            return
        if use_color != '':
            self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
                                  % use_color)
        color_flag = '-fdiagnostics-color=always'
        # Check if the compiler supports the color diagnostics flag. Issue a
        # warning if it does not since color diagnostics have been requested.
        if not self.cxx.hasCompileFlag(color_flag):
            self.lit_config.warning(
                'color diagnostics have been requested but are not supported '
                'by the compiler')
        else:
            self.cxx.flags += [color_flag]

    def configure_debug_mode(self):
        debug_level = self.get_lit_conf('debug_level', None)
        if not debug_level:
            return
        if debug_level not in ['0', '1']:
            self.lit_config.fatal('Invalid value for debug_level "%s".'
                                  % debug_level)
        self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level]

    def configure_warnings(self):
        enable_warnings = self.get_lit_bool('enable_warnings', False)
        if enable_warnings:
            self.cxx.compile_flags += [
                '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
                '-Wall', '-Werror'
            ]
            self.cxx.addWarningFlagIfSupported('-Wno-attributes')
            self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
            self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
            self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
            # TODO(EricWF) Remove the unused warnings once the test suite
            # compiles clean with them.
            self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
            self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
            std = self.get_lit_conf('std', None)
            if std in ['c++98', 'c++03']:
                # The '#define static_assert' provided by libc++ in C++03 mode
                # causes an unused local typedef whenever it is used.
                self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')

    def configure_sanitizer(self):
        san = self.get_lit_conf('use_sanitizer', '').strip()
        if san:
            # Search for llvm-symbolizer along the compiler path first
            # and then along the PATH env variable.
            symbolizer_search_paths = os.environ.get('PATH', '')
            cxx_path = lit.util.which(self.cxx.path)
            if cxx_path is not None:
                symbolizer_search_paths = (
                    os.path.dirname(cxx_path) +
                    os.pathsep + symbolizer_search_paths)
            llvm_symbolizer = lit.util.which('llvm-symbolizer',
                                             symbolizer_search_paths)
            # Setup the sanitizer compile flags
            self.cxx.flags += ['-g', '-fno-omit-frame-pointer']
            if self.target_info.platform() == 'linux':
                # The libraries and their order are taken from the
                # linkSanitizerRuntimeDeps function in
                # clang/lib/Driver/Tools.cpp
开发者ID:darlinghq,项目名称:darling-libcxx,代码行数:70,代码来源:config.py

示例2: Configuration

# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import addWarningFlagIfSupported [as 别名]

#.........这里部分代码省略.........
        elif target_platform.startswith("freebsd"):
            self.cxx.link_flags += ["-lc", "-lm", "-lpthread", "-lgcc_s", "-lcxxrt"]
        else:
            self.lit_config.fatal("unrecognized system: %r" % target_platform)

    def configure_color_diagnostics(self):
        use_color = self.get_lit_conf("color_diagnostics")
        if use_color is None:
            use_color = os.environ.get("LIBCXX_COLOR_DIAGNOSTICS")
        if use_color is None:
            return
        if use_color != "":
            self.lit_config.fatal('Invalid value for color_diagnostics "%s".' % use_color)
        color_flag = "-fdiagnostics-color=always"
        # Check if the compiler supports the color diagnostics flag. Issue a
        # warning if it does not since color diagnostics have been requested.
        if not self.cxx.hasCompileFlag(color_flag):
            self.lit_config.warning("color diagnostics have been requested but are not supported " "by the compiler")
        else:
            self.cxx.flags += [color_flag]

    def configure_debug_mode(self):
        debug_level = self.get_lit_conf("debug_level", None)
        if not debug_level:
            return
        if debug_level not in ["0", "1"]:
            self.lit_config.fatal('Invalid value for debug_level "%s".' % debug_level)
        self.cxx.compile_flags += ["-D_LIBCPP_DEBUG=%s" % debug_level]

    def configure_warnings(self):
        enable_warnings = self.get_lit_bool("enable_warnings", False)
        if enable_warnings:
            self.cxx.compile_flags += ["-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER", "-Wall", "-Werror"]
            self.cxx.addWarningFlagIfSupported("-Wno-attributes")
            self.cxx.addWarningFlagIfSupported("-Wno-pessimizing-move")
            self.cxx.addWarningFlagIfSupported("-Wno-c++11-extensions")
            self.cxx.addWarningFlagIfSupported("-Wno-user-defined-literals")
            # TODO(EricWF) Remove the unused warnings once the test suite
            # compiles clean with them.
            self.cxx.addWarningFlagIfSupported("-Wno-unused-local-typedef")
            self.cxx.addWarningFlagIfSupported("-Wno-unused-variable")
            std = self.get_lit_conf("std", None)
            if std in ["c++98", "c++03"]:
                # The '#define static_assert' provided by libc++ in C++03 mode
                # causes an unused local typedef whenever it is used.
                self.cxx.addWarningFlagIfSupported("-Wno-unused-local-typedef")

    def configure_sanitizer(self):
        san = self.get_lit_conf("use_sanitizer", "").strip()
        if san:
            # Search for llvm-symbolizer along the compiler path first
            # and then along the PATH env variable.
            symbolizer_search_paths = os.environ.get("PATH", "")
            cxx_path = lit.util.which(self.cxx.path)
            if cxx_path is not None:
                symbolizer_search_paths = os.path.dirname(cxx_path) + os.pathsep + symbolizer_search_paths
            llvm_symbolizer = lit.util.which("llvm-symbolizer", symbolizer_search_paths)
            # Setup the sanitizer compile flags
            self.cxx.flags += ["-g", "-fno-omit-frame-pointer"]
            if self.target_info.platform() == "linux":
                self.cxx.link_flags += ["-ldl"]
            if san == "Address":
                self.cxx.flags += ["-fsanitize=address"]
                if llvm_symbolizer is not None:
                    self.env["ASAN_SYMBOLIZER_PATH"] = llvm_symbolizer
                self.config.available_features.add("asan")
开发者ID:jfbastien,项目名称:libcxx,代码行数:70,代码来源:config.py

示例3: Configuration

# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import addWarningFlagIfSupported [as 别名]

#.........这里部分代码省略.........
                                  % use_color)
        color_flag = '-fdiagnostics-color=always'
        # Check if the compiler supports the color diagnostics flag. Issue a
        # warning if it does not since color diagnostics have been requested.
        if not self.cxx.hasCompileFlag(color_flag):
            self.lit_config.warning(
                'color diagnostics have been requested but are not supported '
                'by the compiler')
        else:
            self.cxx.flags += [color_flag]

    def configure_debug_mode(self):
        debug_level = self.get_lit_conf('debug_level', None)
        if not debug_level:
            return
        if debug_level not in ['0', '1']:
            self.lit_config.fatal('Invalid value for debug_level "%s".'
                                  % debug_level)
        self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level]

    def configure_warnings(self):
        # Turn on warnings by default for Clang based compilers when C++ >= 11
        default_enable_warnings = self.cxx.type in ['clang', 'apple-clang'] \
            and len(self.config.available_features.intersection(
                ['c++11', 'c++14', 'c++1z'])) != 0
        enable_warnings = self.get_lit_bool('enable_warnings',
                                            default_enable_warnings)
        if enable_warnings:
            self.cxx.useWarnings(True)
            self.cxx.warning_flags += [
                '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
                '-Wall', '-Wextra', '-Werror'
            ]
            self.cxx.addWarningFlagIfSupported('-Wshadow')
            self.cxx.addWarningFlagIfSupported('-Wno-unused-command-line-argument')
            self.cxx.addWarningFlagIfSupported('-Wno-attributes')
            self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
            self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
            self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
            # These warnings should be enabled in order to support the MSVC
            # team using the test suite; They enable the warnings below and
            # expect the test suite to be clean.
            self.cxx.addWarningFlagIfSupported('-Wsign-compare')
            self.cxx.addWarningFlagIfSupported('-Wunused-variable')
            self.cxx.addWarningFlagIfSupported('-Wunused-parameter')
            self.cxx.addWarningFlagIfSupported('-Wunreachable-code')
            # FIXME: Enable the two warnings below.
            self.cxx.addWarningFlagIfSupported('-Wno-conversion')
            self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
            std = self.get_lit_conf('std', None)
            if std in ['c++98', 'c++03']:
                # The '#define static_assert' provided by libc++ in C++03 mode
                # causes an unused local typedef whenever it is used.
                self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')

    def configure_sanitizer(self):
        san = self.get_lit_conf('use_sanitizer', '').strip()
        if san:
            self.target_info.add_sanitizer_features(san, self.config.available_features)
            # Search for llvm-symbolizer along the compiler path first
            # and then along the PATH env variable.
            symbolizer_search_paths = os.environ.get('PATH', '')
            cxx_path = lit.util.which(self.cxx.path)
            if cxx_path is not None:
                symbolizer_search_paths = (
                    os.path.dirname(cxx_path) +
开发者ID:AstroVPK,项目名称:LLVM-4.0.0,代码行数:70,代码来源:config.py

示例4: Configuration

# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import addWarningFlagIfSupported [as 别名]

#.........这里部分代码省略.........
            self.lit_config.fatal("C++ ABI setting %s unsupported for tests" % cxx_abi)

    def configure_extra_library_flags(self):
        self.target_info.add_cxx_link_flags(self.cxx.link_flags)

    def configure_color_diagnostics(self):
        use_color = self.get_lit_conf("color_diagnostics")
        if use_color is None:
            use_color = os.environ.get("LIBCXX_COLOR_DIAGNOSTICS")
        if use_color is None:
            return
        if use_color != "":
            self.lit_config.fatal('Invalid value for color_diagnostics "%s".' % use_color)
        color_flag = "-fdiagnostics-color=always"
        # Check if the compiler supports the color diagnostics flag. Issue a
        # warning if it does not since color diagnostics have been requested.
        if not self.cxx.hasCompileFlag(color_flag):
            self.lit_config.warning("color diagnostics have been requested but are not supported " "by the compiler")
        else:
            self.cxx.flags += [color_flag]

    def configure_debug_mode(self):
        debug_level = self.get_lit_conf("debug_level", None)
        if not debug_level:
            return
        if debug_level not in ["0", "1"]:
            self.lit_config.fatal('Invalid value for debug_level "%s".' % debug_level)
        self.cxx.compile_flags += ["-D_LIBCPP_DEBUG=%s" % debug_level]

    def configure_warnings(self):
        enable_warnings = self.get_lit_bool("enable_warnings", False)
        if enable_warnings:
            self.cxx.warning_flags += ["-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER", "-Wall", "-Wextra", "-Werror"]
            self.cxx.addWarningFlagIfSupported("-Wno-unused-command-line-argument")
            self.cxx.addWarningFlagIfSupported("-Wno-attributes")
            self.cxx.addWarningFlagIfSupported("-Wno-pessimizing-move")
            self.cxx.addWarningFlagIfSupported("-Wno-c++11-extensions")
            self.cxx.addWarningFlagIfSupported("-Wno-user-defined-literals")
            # TODO(EricWF) Remove the unused warnings once the test suite
            # compiles clean with them.
            self.cxx.addWarningFlagIfSupported("-Wno-unused-local-typedef")
            self.cxx.addWarningFlagIfSupported("-Wno-unused-variable")
            self.cxx.addWarningFlagIfSupported("-Wno-unused-parameter")
            self.cxx.addWarningFlagIfSupported("-Wno-sign-compare")
            std = self.get_lit_conf("std", None)
            if std in ["c++98", "c++03"]:
                # The '#define static_assert' provided by libc++ in C++03 mode
                # causes an unused local typedef whenever it is used.
                self.cxx.addWarningFlagIfSupported("-Wno-unused-local-typedef")

    def configure_sanitizer(self):
        san = self.get_lit_conf("use_sanitizer", "").strip()
        if san:
            self.target_info.add_sanitizer_features(san, self.config.available_features)
            # Search for llvm-symbolizer along the compiler path first
            # and then along the PATH env variable.
            symbolizer_search_paths = os.environ.get("PATH", "")
            cxx_path = lit.util.which(self.cxx.path)
            if cxx_path is not None:
                symbolizer_search_paths = os.path.dirname(cxx_path) + os.pathsep + symbolizer_search_paths
            llvm_symbolizer = lit.util.which("llvm-symbolizer", symbolizer_search_paths)
            # Setup the sanitizer compile flags
            self.cxx.flags += ["-g", "-fno-omit-frame-pointer"]
            if san == "Address":
                self.cxx.flags += ["-fsanitize=address"]
                if llvm_symbolizer is not None:
开发者ID:mpark,项目名称:libcxx,代码行数:70,代码来源:config.py

示例5: Configuration

# 需要导入模块: from libcxx.compiler import CXXCompiler [as 别名]
# 或者: from libcxx.compiler.CXXCompiler import addWarningFlagIfSupported [as 别名]

#.........这里部分代码省略.........
        if use_color is None:
            use_color = os.environ.get('LIBCXX_COLOR_DIAGNOSTICS')
        if use_color is None:
            return
        if use_color != '':
            self.lit_config.fatal('Invalid value for color_diagnostics "%s".'
                                  % use_color)
        color_flag = '-fdiagnostics-color=always'
        # Check if the compiler supports the color diagnostics flag. Issue a
        # warning if it does not since color diagnostics have been requested.
        if not self.cxx.hasCompileFlag(color_flag):
            self.lit_config.warning(
                'color diagnostics have been requested but are not supported '
                'by the compiler')
        else:
            self.cxx.flags += [color_flag]

    def configure_debug_mode(self):
        debug_level = self.get_lit_conf('debug_level', None)
        if not debug_level:
            return
        if debug_level not in ['0', '1']:
            self.lit_config.fatal('Invalid value for debug_level "%s".'
                                  % debug_level)
        self.cxx.compile_flags += ['-D_LIBCPP_DEBUG=%s' % debug_level]

    def configure_warnings(self):
        enable_warnings = self.get_lit_bool('enable_warnings', False)
        if enable_warnings:
            self.cxx.compile_flags += [
                '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER',
                '-Wall', '-Werror'
            ]
            self.cxx.addWarningFlagIfSupported('-Wno-attributes')
            self.cxx.addWarningFlagIfSupported('-Wno-pessimizing-move')
            self.cxx.addWarningFlagIfSupported('-Wno-c++11-extensions')
            self.cxx.addWarningFlagIfSupported('-Wno-user-defined-literals')
            # TODO(EricWF) Remove the unused warnings once the test suite
            # compiles clean with them.
            self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')
            self.cxx.addWarningFlagIfSupported('-Wno-unused-variable')
            std = self.get_lit_conf('std', None)
            if std in ['c++98', 'c++03']:
                # The '#define static_assert' provided by libc++ in C++03 mode
                # causes an unused local typedef whenever it is used.
                self.cxx.addWarningFlagIfSupported('-Wno-unused-local-typedef')

    def configure_sanitizer(self):
        san = self.get_lit_conf('use_sanitizer', '').strip()
        if san:
            self.target_info.add_sanitizer_features(san, self.config.available_features)
            # Search for llvm-symbolizer along the compiler path first
            # and then along the PATH env variable.
            symbolizer_search_paths = os.environ.get('PATH', '')
            cxx_path = lit.util.which(self.cxx.path)
            if cxx_path is not None:
                symbolizer_search_paths = (
                    os.path.dirname(cxx_path) +
                    os.pathsep + symbolizer_search_paths)
            llvm_symbolizer = lit.util.which('llvm-symbolizer',
                                             symbolizer_search_paths)
            # Setup the sanitizer compile flags
            self.cxx.flags += ['-g', '-fno-omit-frame-pointer']
            if san == 'Address':
                self.cxx.flags += ['-fsanitize=address']
                if llvm_symbolizer is not None:
开发者ID:endlessm,项目名称:chromium-browser,代码行数:70,代码来源:config.py


注:本文中的libcxx.compiler.CXXCompiler.addWarningFlagIfSupported方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。