How to suppress deprecation warning for a single function in C? - clang

I would like to suppress deprecation warnings for a single function in C. I.e., I want that the use of a function:
void deprecated_func(void)
stop to produce a deprecation warning, while I would like that all other deprecated functions still continue to produce deprecation warning (i.e., I still want a warning if using void another_deprecated_func(void)).
I can find some solutions for ignoring deprecation warnings on all functions (see for example Suppressing a deprecated warning for a single line ), but not for a single function. Any idea if this is doable and how in c-lang? (I am using GCC, so a GCC-solution would be enough, but if you have something general it would be great :) ).

Related

How to set optuna's study.optimize verbosity to 0?

I want to set optuna's study.optimize verbosity to 0. I thought optuna.logging.set_verbosity(0) might do it, but I still get the Trial 0 finished with value .... updates for every trial
What is the correct way to do this? Unfortunately, extensive searching through the docs still only results in the above method.
Many thanks in advance
Try this:
optuna.logging.set_verbosity(optuna.logging.WARNING)
It basically changes the level of verbosity.
For more level choices, check optuna's official guides here.
optuna warnings tend to be raised using standard pythonic warnings.warn() (which explains why optuna.logging.set_verbosity() does not always work to suppress them), so you can silence them all at once with:
# treat all python warnings as lower-level "ignore" events
warnings.filterwarnings("ignore")
Be aware however, that this will silence also the useful and infrequent ones like deprecation warnings.

Prevent ArmClang to add calls to Standard C library

I am evaluating Keil Microvision IDE on STM32H753.
I am doing compiler comparison between ARMCC5 and AC6 in the different optimisation levels. AC6 is based on Clang.
My code is not using memcpy and I have unchecked "Use MicroLIB" in the project settings , However a basic byte per byte copy loop in my code is replaced by a memcpy with AC6 (only in "high" optimisation levels). It doesn't happen with ARMCC5.
I tried using compilation options to avoid that, as described here: -ffreestanding and -disable-simplify-libcalls, at both compiler and linker levels but it didn't change (for the second option, I get an error message saying that the option is not supported).
In the ARMCLANG reference guide i've found the options -nostdlib -nostdlibinc that prevent (??) the compiler to use any function of a standard lib.
However I still need the math.h function.
Do you know how to prevent clang to use functions from the Standard C Lib that are not explicitely called in the code ?
EDIT: here is a quick and dirty reproduceable example:
https://godbolt.org/z/AX8_WV
Please do not discuss the quality of this example, I know it is dumb !!, I know about memset, etc... It is just to understand the issue
gcc know a lot about the memcpy, memset and similar functions and even they are called "the builtin functions". If you do not want those functions to be used by default just use the command line option -fno-builtin
https://godbolt.org/z/a42m4j

Getter/setter "is used reflectively but not in MirrorsUsed" warning after dart2js compilation

In my class, I have getters and setters which are working thanks to NoSuchMethod - that is, they're not explicitly defined. After I compile and run the js, I get the following error in the browser console:
Warning: 'closes_in=' is used reflectively but not in MirrorsUsed. This will break minified code.
In this case, closes_in= is an example of such a setter and there are some other warnings related to other getters/setters too. I do have a #MirrorsUsed with the name of the library/class included and the resulting compiled js is actually smaller than it was without using #MirrorsUsed statements.
However, if a -m flag is passed to dart2js, then when the js program runs it fails - as predicted by the warning message.
Thus, I have two questions:
1. How do I write my #MirrorsUsed statement so that the warning goes away?
2. If it's not possible, how do I suppress the warning message? (because if it's not possible to solve the problem, then my only option would be to NOT minify the file then).

how can I use regexp:sh_to_awk and regexp:match in erlang v5.10.4

I have a module using regexp:sh_to_awk and regexp:match.
But when I compile it, the compiler warns me that the regexp module was removed from R15 and recommends me to use the re module instead.
I searched the erlang documentation but I can't find how to replace the two functions.
Can anyone tell me how to fix this?
Indeed, regexp module has been deprecated for a while and has now been removed, replaced by the re module.
The old regexp:match function has been replaced by the re:run functions, which add a lot of functionality, such as returning captured parts as lists or binary (The old way of returning start position and length also remains):
> re:run("Test String","[a-zA-Z]{4}",[{capture,all,list},global]).
{match,[["Test"],["Stri"]]}
Read through the re:run/3 documentation, it's worth it, just as all the other functions of the re module (like compile and replace).
The regexp:sh_to_awk has been removed. You can use the filelib:wildcard functions for matching filenames, if that was your intended use of the old regexp:sh_to_awk/1 function.

F# Suppress Warnings

Sometimes I get annoying pattern matching and indent warnings when compiling F#. Is there a way to disable warnings? I'm pretty OCD over warnings.
In case you forget, you can type
let rec x = lazy(x.Value)
and get the warning
This and other recursive references to
the object(s) being defined will be
checked for initialization-soundness
at runtime through the use of a
delayed reference. This is because you
are defining one or more recursive
objects, rather than recursive
functions. This warning may be
suppressed by using '#nowarn "40"' or
'--nowarn:40'.
which shows that you can use either the compiler flag --nowarn on the command-line, or use the hash-directive #nowarn in your code. The warning number for each warning will be part of the build output (the Visual Studio error list does not display the numbers, so if in VS, build and then inspect the build output). Also, if inside VS, you can go to the project properties page, "Build" tab, and use the "warning level" selector and "suppress warnings" field (a semicolon-delimited list of numbers) to control which warnings are diplayed via the VS UI.
(BTW, I believe #nowarn only turns off the warning in the current file, whereas --nowarn turns it off for the entire project being compiled.)
See: Compiler Options (F#)
--nowarn:<int-list>:
Disable specific warnings listed by
number. Separate each warning number
by a comma. You can discover the
warning number for any warning from
the compilation output.
This compiler option is equivalent to
the C# compiler option of the same
name. For more information, see
/nowarn (C# Compiler Options).

Resources