[all-commits] [llvm/llvm-project] 56c3b8: [clang][Sema] Make format size estimator aware of ...

Takuya Shimizu via All-commits all-commits at lists.llvm.org
Sun Sep 24 18:04:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56c3b8e997d065b568964f71715ecbbd28c2e4a4
      https://github.com/llvm/llvm-project/commit/56c3b8e997d065b568964f71715ecbbd28c2e4a4
  Author: Takuya Shimizu <shimizu2486 at gmail.com>
  Date:   2023-09-25 (Mon, 25 Sep 2023)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticGroups.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaChecking.cpp
    M clang/test/Misc/warning-wall.c
    A clang/test/Sema/warn-format-overflow-truncation.c
    M clang/test/Sema/warn-fortify-source.c

  Log Message:
  -----------
  [clang][Sema] Make format size estimator aware of %p's existence in format string (#65969)

This change introduces `-Wformat-overflow` and `-Wformat-truncation` warning flags that were formerly diagnosed from `-Wfortify-source` warning group.
This also introduces `-Wformat-overflow-non-kprintf` and `-Wformat-truncation-non-kprintf`, both of which will be used when the format string contains `%p` format string.

The rationale for this is that Linux kernel has its own extension for `%p` format specifier, and we need some way to suppress false positives in kernel codebase.
The approach of this patch aims NOT to affect non-kernel codebases.
Note that GCC stops format size estimation upon `%p` format specifier.

As requested in https://github.com/llvm/llvm-project/issues/64871




More information about the All-commits mailing list