Files
swift-mirror/include/swift/AST/DefineDiagnosticMacros.h
Dmitrii Galimzianov 28883b6654 [Diagnostics] Add -[no-]warning-as-error flags for precise control over warning behavior
This commit adds new compiler options -no-warning-as-error/-warning-as-error which allows users to specify behavior for exact warnings and warning groups.
2024-09-07 01:14:43 +02:00

83 lines
2.2 KiB
C++

//===--- DefineDiagnosticMacros.h - Shared Diagnostic Macros ----*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2020 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines macros shared across diagnostic definition files.
//
//===----------------------------------------------------------------------===//
// Define macros
#ifdef DEFINE_DIAGNOSTIC_MACROS
#if !(defined(DIAG) || (defined(GROUPED_ERROR) && defined(GROUPED_WARNING) && \
defined(NOTE) && defined(REMARK)))
#error Must define either DIAG or the set {GROUPED_ERROR,GROUPED_WARNING,NOTE,REMARK}
#endif
#ifndef GROUPED_ERROR
#define GROUPED_ERROR(ID, Group, Options, Text, Signature) \
DIAG(ERROR, ID, Group, Options, Text, Signature)
#endif
#ifndef ERROR
#define ERROR(ID, Options, Text, Signature) \
GROUPED_ERROR(ID, no_group, Options, Text, Signature)
#endif
#ifndef GROUPED_WARNING
#define GROUPED_WARNING(ID, Group, Options, Text, Signature) \
DIAG(WARNING, ID, Group, Options, Text, Signature)
#endif
#ifndef WARNING
#define WARNING(ID, Options, Text, Signature) \
GROUPED_WARNING(ID, no_group, Options, Text, Signature)
#endif
#ifndef NOTE
#define NOTE(ID, Options, Text, Signature) \
DIAG(NOTE, ID, no_group, Options, Text, Signature)
#endif
#ifndef REMARK
#define REMARK(ID, Options, Text, Signature) \
DIAG(REMARK, ID, no_group, Options, Text, Signature)
#endif
#ifndef FIXIT
#define FIXIT(ID, Text, Signature)
#endif
#undef DEFINE_DIAGNOSTIC_MACROS
#endif
// Undefine macros
#ifdef UNDEFINE_DIAGNOSTIC_MACROS
#ifndef DIAG_NO_UNDEF
#if defined(DIAG)
#undef DIAG
#endif
#undef REMARK
#undef NOTE
#undef WARNING
#undef GROUPED_WARNING
#undef ERROR
#undef GROUPED_ERROR
#undef FIXIT
#endif
#undef UNDEFINE_DIAGNOSTIC_MACROS
#endif