-
Notifications
You must be signed in to change notification settings - Fork 248
Configure Clang static analyzer CI #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
|
|
||
| name: Clang Static Analyzer | ||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| Analyze: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| submodules: true | ||
|
|
||
| - name: Prepare | ||
| run: | | ||
| sudo apt-get -qq update | ||
| sudo apt-get -qq install ninja-build clang-tools | ||
|
|
||
| - name: Configure | ||
| run: | | ||
| mkdir build | ||
| cd build | ||
| scan-build cmake -G Ninja -DPCRE2_SUPPORT_JIT=ON -DCMAKE_BUILD_TYPE=Debug .. | ||
|
|
||
| - name: Build | ||
| run: | | ||
| # Inefficiently run clang scan twice; once to generate HTML, and secondly | ||
| # to generate SARIF files. Ideally we would have some way to scan once and | ||
| # generate one of those outputs from the other, but I don't know a good way | ||
| # to do that. | ||
| cd build | ||
| scan-build -o clang-report/ ninja | ||
|
|
||
| ninja clean | ||
| scan-build -o clang-sarif -sarif ninja | ||
| # Work around issue in GitHub's SARIF ingestion - merge all SARIF files into one | ||
| npx -y @microsoft/sarif-multitool merge clang-sarif/*/*.sarif --output-file=clang.sarif | ||
|
|
||
| # Upload the browsable HTML report as an artifact. | ||
| - name: Upload report | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: "Clang Static Analyzer report" | ||
| path: './build/clang-report' | ||
|
|
||
| # Upload the results to GitHub's code scanning dashboard. | ||
| - name: "Upload to code-scanning" | ||
| uses: github/codeql-action/upload-sarif@v3 | ||
| with: | ||
| sarif_file: build/clang.sarif | ||
| category: clang-analyzer |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1539,12 +1539,13 @@ switch(endlinetype) | |
| for (;;) | ||
| { | ||
| while (p < endptr && *p != '\r') p++; | ||
| if (++p >= endptr) | ||
| if (p == endptr) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code change here should absolutely no effect. However, it silences the Clang warning. The old code would do Clang notices that this is Undefined Behaviour (you can legally construct a one-past-the-end pointer, but no further). My updated code here simply ensures that |
||
| { | ||
| *lenptr = 0; | ||
| return endptr; | ||
| } | ||
| if (*p == '\n') | ||
| p++; | ||
| if (p < endptr && *p == '\n') | ||
| { | ||
| *lenptr = 2; | ||
| return p + 1; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.