[all-commits] [llvm/llvm-project] 6ac504: [flang] Escape '%' in %VAL/%REF messages (#94331)

Leandro Lupori via All-commits all-commits at lists.llvm.org
Tue Jun 4 09:12:20 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6ac5047aa6bf12644e38afb188bd8d821a181ba5
      https://github.com/llvm/llvm-project/commit/6ac5047aa6bf12644e38afb188bd8d821a181ba5
  Author: Leandro Lupori <leandro.lupori at linaro.org>
  Date:   2024-06-04 (Tue, 04 Jun 2024)

  Changed paths:
    M flang/lib/Semantics/check-call.cpp

  Log Message:
  -----------
  [flang] Escape '%' in %VAL/%REF messages (#94331)

flang/test/Semantics/call40.f90 was failing on Darwin:
actual at 27: VAL or REF are not allowed for dummy argument 'a='
  that must be passed by means of a descriptor
expect at 27: %VAL or %REF are not allowed for dummy argument 'a='
  that must be passed by means of a descriptor

When messages.Say() is called with more arguments than just the
fixed text message, the message is treated as a format string,
passed to vsnprintf. Therefore, the '%' chars in it must be
escaped.

Note that no conversion happens when there is only a fixed text
message. Escaping '%' in this case causes "%%" to be outputted.
This can be confusing for someone expecting printf-like behavior.
Processing these text messages with snprintf could solve this,
as a future improvement.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list