[all-commits] [llvm/llvm-project] 503499: [Sema] Warning for _Float16 passed to format speci...

Haocong Lu via All-commits all-commits at lists.llvm.org
Sun Jan 7 17:50:50 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5034994134bbec92c1f1116c56008ac504f7d763
      https://github.com/llvm/llvm-project/commit/5034994134bbec92c1f1116c56008ac504f7d763
  Author: Haocong Lu <74847248+Luhaocong at users.noreply.github.com>
  Date:   2024-01-08 (Mon, 08 Jan 2024)

  Changed paths:
    M clang/lib/AST/FormatString.cpp
    M clang/test/Sema/attr-format.c
    M clang/test/SemaCXX/attr-format.cpp
    M clang/test/SemaCXX/format-strings-scanf.cpp

  Log Message:
  -----------
  [Sema] Warning for _Float16 passed to format specifier '%f' (#74439)

According to https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2844.pdf,
default argument promotions for _FloatN types has been removed.

A warning is needed to notice user to promote _Float16 to double
explicitly, and then pass it to format specifier '%f', which is
consistent with GCC.

Fixes: https://github.com/llvm/llvm-project/issues/68538




More information about the All-commits mailing list