mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-25 18:00:10 +01:00
Protobufs code hits a warning with the latest system headers on macOS. I figured this may have been fixed so I updated protobufs and Bazel to the latest releases. This generally cleaned things up. However, it actually added *more* warnings. This clearly isn't a really well tested path. In fact, we already have a disabled warning that we'd like for Carbon code because LLVM isn't clean for that warning. So I've switched our warning strategy to a more durable approach of suppressing all warnings for external repository headers and source files. This lets us re-enable the missing warning and should fix the protobuf warning that started me down this twisty path. Sadly, we *have* to update to Bazel 6 in order to have the necessary flag to use this approach to suppressing warnings, so I couldn't do this as two PRs cleanly. =/ That's why I've bundled both the Bazel (and protobuf) updates with the warning strategy change. Last but not least, I've fixed several unused parameters in Carbon's code that our warnings now catch.
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
#ifndef CARBON_TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_
|
|
#define CARBON_TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_
|
|
|
|
#include "toolchain/diagnostics/diagnostic_emitter.h"
|
|
|
|
namespace Carbon {
|
|
|
|
template <typename LocationT>
|
|
inline auto NullDiagnosticLocationTranslator()
|
|
-> DiagnosticLocationTranslator<LocationT>& {
|
|
struct Translator : DiagnosticLocationTranslator<LocationT> {
|
|
auto GetLocation(LocationT /*loc*/) -> DiagnosticLocation override {
|
|
return {};
|
|
}
|
|
};
|
|
static auto* translator = new Translator;
|
|
return *translator;
|
|
}
|
|
|
|
inline auto NullDiagnosticConsumer() -> DiagnosticConsumer& {
|
|
struct Consumer : DiagnosticConsumer {
|
|
auto HandleDiagnostic(Diagnostic /*d*/) -> void override {}
|
|
};
|
|
static auto* consumer = new Consumer;
|
|
return *consumer;
|
|
}
|
|
|
|
template <typename LocationT>
|
|
inline auto NullDiagnosticEmitter() -> DiagnosticEmitter<LocationT>& {
|
|
static auto* emitter = new DiagnosticEmitter<LocationT>(
|
|
NullDiagnosticLocationTranslator<LocationT>(), NullDiagnosticConsumer());
|
|
return *emitter;
|
|
}
|
|
|
|
} // namespace Carbon
|
|
|
|
#endif // CARBON_TOOLCHAIN_DIAGNOSTICS_NULL_DIAGNOSTICS_H_
|