[llvm] 0963833 - [ExecutionEngine] Silence warnings about sprintf use in interpreter.

Aaron Ballman via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 2 06:21:24 PST 2023


On Wed, Mar 1, 2023 at 6:39 PM Lang Hames via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
>
>
> Author: Lang Hames
> Date: 2023-03-01T15:37:09-08:00
> New Revision: 0963833a194331a8b8d6775dcd1c3025a8154751
>
> URL: https://github.com/llvm/llvm-project/commit/0963833a194331a8b8d6775dcd1c3025a8154751
> DIFF: https://github.com/llvm/llvm-project/commit/0963833a194331a8b8d6775dcd1c3025a8154751.diff
>
> LOG: [ExecutionEngine] Silence warnings about sprintf use in interpreter.
>
> We should review memory safety in the interpreter
> (https://github.com/llvm/llvm-project/issues/58086), but for now just silence
> the warnings to reduce noise.
>
> rdar://100555195
>
> Added:
>
>
> Modified:
>     llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff  --git a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
> index 29f481a1e4e82..73b1023fffac1 100644
> --- a/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
> +++ b/llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
> @@ -344,6 +344,10 @@ static GenericValue lle_X_abort(FunctionType *FT, ArrayRef<GenericValue> Args) {
>    return GenericValue();
>  }
>
> +// Silence warnings about sprintf. (See also
> +// https://github.com/llvm/llvm-project/issues/58086)
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored "-Wdeprecated-declarations"
>  // int sprintf(char *, const char *, ...) - a very rough implementation to make
>  // output useful.
>  static GenericValue lle_X_sprintf(FunctionType *FT,
> @@ -425,6 +429,7 @@ static GenericValue lle_X_sprintf(FunctionType *FT,
>    }
>    return GV;
>  }
> +#pragma clang diagnostic pop

This introduces new warnings when building with anything other than
Clang, so the pragma needs to be protected better. Perhaps we should
add something to Compiler.h that's a more general solution for this
(there are similar pragmas for MSVC and GCC)?

~Aaron

>
>  // int printf(const char *, ...) - a very rough implementation to make output
>  // useful.
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list