gpt4 book ai didi

clang - 是否有只是一个注释的 Clang 诊断?

转载 作者:行者123 更新时间:2023-12-05 01:08:07 31 4
gpt4 key购买 nike

Clang has several kinds of diagnostics ,其中三种主要是错误、警告和注释。

注释通常伴随着某些警告和错误,例如重复定义:

error: conflicting types for 'square'
static double square(double x) {
^
note: previous declaration is here
static int square(int x);
^

我想知道的是,Clang 是否有任何诊断功能——尤其是对于 Objective-C 或 C,但如果必须的话,我会选择 C++——它只包含一个注释,没有相关的错误或警告?

最佳答案

http://clang.llvm.org/docs/InternalsManual.html#the-diagnostic-kinds-td-files说:

These severities are mapped into a smaller set (the Diagnostic::Level enum, {Ignored, Note, Warning, Error, Fatal}) of output levels by the diagnostics subsystem based on various configuration options. Clang internally supports a fully fine grained mapping mechanism that allows you to map almost any diagnostic to the output level that you want. The only diagnostics that cannot be mapped are NOTEs, which always follow the severity of the previously emitted diagnostic and ERRORs, which can only be mapped to Fatal (it is not possible to turn an error into a warning, for example).



所以不幸的是没有;如果不破解 Clang 本身,你就无法做到这一点。注释仅用于链接到其他诊断。我会用 LLVM 跟踪器提交一个错误;这绝对是有用的功能。

关于clang - 是否有只是一个注释的 Clang 诊断?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17559338/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com