changeset 75:90677c4a880a

emit warning when function prototype is not exactly.
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Sun, 04 May 2014 02:24:57 +0900
parents d33e24fd01df
children 9e74acfe8c42
files tools/clang/lib/CodeGen/CGCall.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tools/clang/lib/CodeGen/CGCall.cpp	Sun May 04 00:31:16 2014 +0900
+++ b/tools/clang/lib/CodeGen/CGCall.cpp	Sun May 04 02:24:57 2014 +0900
@@ -453,6 +453,13 @@
     if(!required.allowsOptionalArgs()) // If the code segment is a variadic function , LLVM can't do TCE.
       CC = llvm::CallingConv::Fast;
     else { // emit warning
+      DiagnosticsEngine &Diags = CGM.getDiags();
+      unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Warning, "code segment's function pointer arguments must be written exactly prototype");
+      Diags.Report(DiagID);
+      // how to bring current function name and location here?
+      // todo : do not emit warning when this function declaration is arguments' argument.
+      //      ex) __code (__code(*aua)(int, void*, __code(*)( )))
+      //                                           ^^^^^^^^^^^^ we have not check its argument.          
     }
   }
 #endif