# HG changeset patch # User Kaito Tokumori # Date 1399137897 -32400 # Node ID 90677c4a880afe012beef9a6747797a8066adf47 # Parent d33e24fd01dfe5352902b9ab7d2b5c335f30071f emit warning when function prototype is not exactly. diff -r d33e24fd01df -r 90677c4a880a tools/clang/lib/CodeGen/CGCall.cpp --- 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