From 6b5c2efe55199b988d61863441cbae05e218e863 Mon Sep 17 00:00:00 2001
From: Thibault Martin <thi.martin.pro@pm.me>
Date: Tue, 24 Sep 2024 13:45:56 +0200
Subject: [PATCH] [cabs2cil] Use CALL loc as vdecl for missing prototypes

Loc will be updated once we encounter the definition
---
 src/kernel_internals/typing/cabs2cil.ml       | 2 +-
 tests/syntax/oracle/syntactic_hook.res.oracle | 2 +-
 tests/syntax/syntactic_hook.i                 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/kernel_internals/typing/cabs2cil.ml b/src/kernel_internals/typing/cabs2cil.ml
index c40489e5ab1..c3ba156d600 100644
--- a/src/kernel_internals/typing/cabs2cil.ml
+++ b/src/kernel_internals/typing/cabs2cil.ml
@@ -6408,7 +6408,7 @@ and doExp local_env
                 (* Add a prototype to the environment *)
                 let proto, _ =
                   makeGlobalVarinfo false
-                    (makeGlobalVar ~temp:false n ftype) in
+                    (makeGlobalVar ~temp:false ~loc:f.expr_loc n ftype) in
                 (* Make it EXTERN *)
                 proto.vstorage <- Extern;
                 proto.vdecl <- f.expr_loc;
diff --git a/tests/syntax/oracle/syntactic_hook.res.oracle b/tests/syntax/oracle/syntactic_hook.res.oracle
index dd40fc1cad6..ea620c5e776 100644
--- a/tests/syntax/oracle/syntactic_hook.res.oracle
+++ b/tests/syntax/oracle/syntactic_hook.res.oracle
@@ -10,7 +10,7 @@
 [kernel] syntactic_hook.i:16: New global node introducing identifier t(35)
 [kernel] First occurrence of t
 [kernel] syntactic_hook.i:16: Warning: [SH]: definition of local function t
-[kernel] :0: New global node introducing identifier g(37)
+[kernel] syntactic_hook.i:20: New global node introducing identifier g(37)
 [kernel] First occurrence of g
 [kernel:typing:implicit-function-declaration] syntactic_hook.i:20: Warning: 
   Calling undeclared function g. Old style K&R code?
diff --git a/tests/syntax/syntactic_hook.i b/tests/syntax/syntactic_hook.i
index 7061a2336c6..a5caf8dad3c 100644
--- a/tests/syntax/syntactic_hook.i
+++ b/tests/syntax/syntactic_hook.i
@@ -1,7 +1,7 @@
 /* run.config
  MODULE: @PTEST_NAME@
  EXIT: 1
-   STDOPT: +"-no-autoload-plugins"
+   STDOPT:
 */
 
 
-- 
GitLab