Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/security/nss/coreconf/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 2 kB image not shown  

Quelle  werror.py   Sprache: Python

 
#!/usr/bin/env python

import os
import subprocess

def main():
    cc = os.environ.get('CC''cc')
    sink = open(os.devnull, 'wb')
    try:
        cc_is_clang = 'clang' in subprocess.check_output(
          [cc, '--version'], universal_newlines=True, stderr=sink)
    except OSError:
        # We probably just don't have CC/cc.
        return

    def warning_supported(warning):
        return subprocess.call([cc, '-x''c''-E''-Werror',
                                '-W%s' % warning, os.devnull], stdout=sink, stderr=sink) == 0
    def can_enable():
        # This would be a problem
        if not warning_supported('all'):
            return False

        # If we aren't clang, make sure we have gcc 4.8 at least
        if not cc_is_clang:
            try:
                v = subprocess.check_output([cc, '-dumpversion'], stderr=sink).decode("utf-8")
                v = v.strip(' \r\n').split('.')
                v = list(map(int, v))
                if v[0] < 4 or (v[0] == 4 and v[1] < 8):
                    # gcc 4.8 minimum
                    return False
            except OSError:
                return False
        return True

    if not can_enable():
        print('-DNSS_NO_GCC48')
        return

    print('-Werror')
    print('-Wall')

    def set_warning(warning, contra=''):
        if warning_supported(warning):
            print('-W%s%s' % (contra, warning))

    if cc_is_clang:
        # clang is unable to handle glib's expansion of strcmp and similar for
        # optimized builds, so disable the resulting errors.
        # See https://llvm.org/bugs/show_bug.cgi?id=20144
        for w in ['array-bounds',
                  'unevaluated-expression',
                  'parentheses-equality',
                  'tautological-type-limit-compare',
                  'sign-compare',
                  'comma',
                  'implicit-fallthrough'
                  ]:
            set_warning(w, 'no-')
        for w in ['tautological-constant-in-range-compare',
                  'bitfield-enum-conversion',
                  'empty-body',
                  'format-type-confusion',
                  'ignored-qualifiers',
                  'pointer-arith',
                  'type-limits',
                  'unreachable-code',
                  'unreachable-code-return',
                  'duplicated-cond',
                  'logical-op',
                  'implicit-function-declaration'
                  ]:
            set_warning(w,'')
        print('-Qunused-arguments')

    set_warning('shadow')

if __name__ == '__main__':
    main()

Messung V0.5
C=91 H=96 G=93

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.