abseil / abseil/abseil-cpp

ABSL_FLAG macro triggers abseil-no-namespace check

未關閉
#1,190 2 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
C++
星號
18.1k
分支
3.2k
平均合併
20 小時 36 分鐘
30 天內合併 PR
1

描述

**Describe the bug**

ABSL_FLAG triggers clang-tidy abseil-no-namespace check

**Steps to reproduce the bug**

$ cat main.cc
```
#include "absl/flags/flag.h"
#include "absl/flags/parse.h"

ABSL_FLAG(std::string, input, "input", "input file path");

int main(int argc, char* argv[]) {
absl::ParseCommandLine(argc, argv);

return EXIT_SUCCESS;
}
```

clang-tidy --checks=abseil-* main.cc

```
main.cc:7:1: error: namespace 'absl' is reserved for implementation of the Abseil library and should not be opened in user code [abseil-no-namespace,-warnings-as-errors]
ABSL_FLAG(std::string, input, "input", "input file path");
^
external/com_google_absl/absl/flags/flag.h:166:3: note: expanded from macro 'ABSL_FLAG'
ABSL_FLAG_IMPL(Type, name, default_value, help)
^
external/com_google_absl/absl/flags/flag.h:269:13: note: expanded from macro 'ABSL_FLAG_IMPL'
namespace absl /* block flags in namespaces */ {} \
^
```

**What version of Abseil are you using?**

f3489c9ca64e0fad2a263e8560ee96718ac8b21b

**What operating system and version are you using**

Ubuntu 18.04

**What compiler and version are you using?**

clang-tidy-13

**What build system are you using?**

bazel 4.2.2

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。