Files
swift-mirror/include/swift/AST/DefineDiagnosticGroupsMacros.h
Artem Chikin 9e35f82b2c [Diagnostics] Replace diagnostics' 'DefaultIgnore' option with a corresponding option on diagnostic groups
This brings this control in line with other diagnostic controls we have which operate on a per-group level.
'DefaultIgnoreWarnings' diagnostic group option applies to all warnings belonging to a certain diagnostic group.

The inheritance rules are:
- Marking a diagnostic group as 'DefaultIgnoreWarnings' means warnings belonging to this group will not be emitted by-default
  - Warnings belonging to sub-groups of this group will also not be emitted by-default
- Enabling a 'DefaultIgnoreWarnings' group (with '-Werror','-Wwarning', etc.) means warnings belonging to this group will be emitted.
  - Warnings belonging to sub-groups of this group will also be emitted.
  - Warnings belonging to super-groups of this group will not be affected.
2025-10-29 09:42:03 -07:00

69 lines
2.2 KiB
C++

//===--- DefineDiagnosticGroupsMacros.def -----------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2024 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 defining diagnostic groups.
//
//===----------------------------------------------------------------------===//
// Define macros
#if defined(DEFINE_DIAGNOSTIC_GROUPS_MACROS) && \
!defined(UNDEFINE_DIAGNOSTIC_GROUPS_MACROS)
#undef DEFINE_DIAGNOSTIC_GROUPS_MACROS
#if !(defined(GROUP) || defined(GROUP_LINK))
#error No reqired macros defined. Define at least one of the following macros: GROUP(Name, DocsFile), GROUP_LINK(Parent, Child)
#endif
// GROUP macro:
// Declares a diagnostic group.
// Parameters:
// Name - group name as it appears in DiagGroupID enum and DiagGroupInfo.name
// Option - attribute applying to members of this diagnostic group
// DocsFile - file with a human readable description for the group located in
// userdocs/diagnostic_groups
#ifndef GROUP
#define GROUP(Name, Option, DocsFile)
#endif
// GROUP_LINK macro:
// Establishes an edge in the diagnostic group graph between
// a supergroup(Parent) and its subgroup(Child).
// Parameters:
// Parent - parent group name
// Child - child group name
#ifndef GROUP_LINK
#define GROUP_LINK(Parent, Child)
#endif
// Undefine macros
#elif defined(UNDEFINE_DIAGNOSTIC_GROUPS_MACROS) && \
!defined(DEFINE_DIAGNOSTIC_GROUPS_MACROS)
#undef UNDEFINE_DIAGNOSTIC_GROUPS_MACROS
#ifdef GROUP
#undef GROUP
#else
#error Trying to undefine the diagnostic groups macros, but GROUP macro wasn't defined
#endif
#ifdef GROUP_LINK
#undef GROUP_LINK
#else
#error Trying to undefine the diagnostic groups macros, but GROUP_LINK macro wasn't defined
#endif
#else
#error Invalid DefineDiagnosticGroupsMacros.h inclusion
#endif