Skip to content
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

[🍒][-Wunsafe-buffer-usage] Warning unsafe libc calls #9287

Open
wants to merge 6 commits into
base: stable/20240723
Choose a base branch
from

Commits on Sep 19, 2024

  1. [-Wunsafe-buffer-usage] Warning Libc functions (llvm#101583)

    [-Wunsafe-buffer-usage] Add warn on unsafe calls to libc functions
    
    Warning about calls to libc functions involving buffer access.  Warned
    functions are hardcoded by names.
    
    (rdar://117182250)
    
    (cherry picked from commit 0fffdeb)
    ziqingluo-90 authored and ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    af32c43 View commit details
    Browse the repository at this point in the history
  2. Revert "[-Wunsafe-buffer-usage] Warning Libc functions (llvm#101583)"

    This reverts commit 0fffdeb.
    
    Will re-land this commit soon with a way to opt-out
    
    (cherry picked from commit 2345796)
    ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    9cca51b View commit details
    Browse the repository at this point in the history
  3. Re-land "[-Wunsafe-buffer-usage] Warning Libc functions (llvm#101583)"

    Revert commit 2345796, and re-land
    with a new flag "-Wunsafe-buffer-usage-in-libc-call" for the new
    warning.
    
    (rdar://117182250)
    
    (cherry picked from commit d7dd2c4)
    ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    4758aaf View commit details
    Browse the repository at this point in the history
  4. [-Wunsafe-buffer-usage] Fix a bug in "warning libc functions (llvm#10…

    …1583)"
    
    The commit d7dd2c4 crashes for such
    an example:
    ```
    void printf() { printf(); }
    ```
    Because it assumes `printf` must have arguments. This commit fixes
    this issue.
    
    (rdar://117182250)
    
    (cherry picked from commit de88d7d)
    ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    ef2f153 View commit details
    Browse the repository at this point in the history
  5. [-Wunsafe-buffer-usage] Reduce false positives with constant arrays i…

    …n libc warnings (llvm#108308)
    
    For `snprintf(a, sizeof a, ...)`, the first two arguments form a safe
    pattern if `a` is a constant array. In such a case, this commit will
    suppress the warning.
    
    (rdar://117182250)
    
    (cherry picked from commit ebf25d9)
    ziqingluo-90 authored and ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    90b4126 View commit details
    Browse the repository at this point in the history
  6. [-Wunsafe-buffer-usage] Fix a bug in "Re-land [-Wunsafe-buffer-usage]…

    … Warning Libc functions (llvm#101583)"
    
    StringLiteral::getString() is not applicable to strings of wide
    characters.  Added handling for that.
    
    (rdar://117182250)
    
    (cherry picked from commit 48498ec)
    ziqingluo-90 committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    9ddbe6a View commit details
    Browse the repository at this point in the history