From 177f363195c8acac8c51e113f46f07f325a401ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Patte?= <sebastien.patte@cea.fr>
Date: Wed, 24 Jan 2024 17:11:46 +0100
Subject: [PATCH] [Variadic] Improve warning message about intmax_t and fix
 issue with %lc

---
 src/plugins/variadic/format_typer.ml | 2 +-
 src/plugins/variadic/standard.ml     | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/variadic/format_typer.ml b/src/plugins/variadic/format_typer.ml
index 3a9fc3992f3..656b534c948 100644
--- a/src/plugins/variadic/format_typer.ml
+++ b/src/plugins/variadic/format_typer.ml
@@ -65,7 +65,7 @@ let type_f_specifier ?find_typedef spec =
   | #float_specifier, Some `l -> Cil.doubleType
   | #float_specifier, Some `L -> Cil.longDoubleType
   | `c, None    -> Cil.intType
-  | `c, Some `l -> get_typedef ?find_typedef "intmax_t"
+  | `c, Some `l -> get_typedef ?find_typedef "wchar_t"
   | `s, None    -> Cil.charPtrType
   | `s, Some `l -> ptr (get_typedef ?find_typedef "wchar_t")
   | `p, None    -> Cil.voidPtrType
diff --git a/src/plugins/variadic/standard.ml b/src/plugins/variadic/standard.ml
index 98eefe0444d..ae07bb0df4e 100644
--- a/src/plugins/variadic/standard.ml
+++ b/src/plugins/variadic/standard.ml
@@ -731,13 +731,13 @@ let format_fun_call ~builder env format_fun vf args =
   let tvparams =
     try
       Format_typer.type_format ~find_typedef format
-    with Format_typer.Type_not_found type_name ->
+    with Format_typer.Type_not_found (type_name) ->
       Self.warning ~current:true
         "Unable to find type %s in the source code which should be used in \
          this call:@ no specification will be generated.@ \
          Note that due to cleanup, the type may have been defined in the \
-         original code but not used anywhere."
-        type_name;
+         original code but not used anywhere.@.\
+         Did you include <stdint.h> ?" type_name;
       raise (Translate_call_exn vf.vf_decl)
   in
 
-- 
GitLab