suppress-warnings

SunStudio C++ compiler pragma to disable warnings?

梦想的初衷 提交于 2019-12-01 20:56:05
The STLport bundled with the SunStudio11 generates alot of warnings. I beleive most compilers have a way to disable warnings from certain source files, like this: Sun C #pragma error_messages off #include <header.h> // ... #pragma error_messages on gcc #pragma warning(push, 0) #include <header.h> // ... #pragma warning(pop) How do you do this in the SunStudio C++ compiler? (btw, the sunstudio C pragmas don't work in sunstudio C++) In SunStudio 12, the #pragma error_messages work as documented in the C users manual. You can see the tags with the -errtags=yes option, and use it like this: //

What is the use of @SuppressWarnings

好久不见. 提交于 2019-12-01 17:24:40
问题 I didn't understand this feature of Java. I know it makes coding easier and sometimes looks neater, but what is the actual use of this? On contrary i feel, its better to display the warnings, as in future any one can refer them before making modifications to code. Does this @SuppressWarnings increases compliling efficiency OR is this according to any coding standards? 回答1: Other answers already explained use cases of @SuppressWarnings a lot, but I want to emphasize the point that sometimes

Java: How to @SuppressWarnings unreachable code?

ぐ巨炮叔叔 提交于 2019-12-01 16:03:36
Sometimes when you are debugging, you have unreachable code fragment. Is there anyway to suppress the warning? The only way to do this on any compiler is @SuppressWarnings("all") . If you're using Eclipse, try @SuppressWarnings("unused") . Java has (primitive) support for debugging like this in that simple if on boolean constants will not generate such warnings (and, indeed when the evaluation is false the compiler will remove the entire conditioned block). So you can do: if(false) { // code you don't want to run } Likewise, if you are temporarily inserting an early termination for debugging,

How do I suppress T-SQL warnings when running a script SQL Server 2005?

空扰寡人 提交于 2019-12-01 15:35:07
Is it possible to suppress warnings generated by T-SQL scripts? If so, how? I know I can turn of the 'records affected' messages with SET NOCOUNT ON but is there an equivalent for warnings? Eg: Warning: Null value is eliminated by an aggregate or other SET operation. If I'm expecting these errors, it helps to sift the real errors from the chaff in a big script. Thanks. Remus Rusanu See SET ANSI_WARNINGS {ON | OFF} 来源: https://stackoverflow.com/questions/1280508/how-do-i-suppress-t-sql-warnings-when-running-a-script-sql-server-2005

Suppress warning for function arguments not used in LISP

白昼怎懂夜的黑 提交于 2019-12-01 03:30:47
问题 In lisp, I need to define a set of functions, all with the same number of arguments. However, the functions may or may not use all the arguments, leading to a spur of warning messages. For example: (defun true (X Y) X) [...] ; caught STYLE-WARNING: ; The variable Y is defined but never used. Is there a way to warn the compiler that is was intended? 回答1: See the Common Lisp Hyperspec: Declaration IGNORE, IGNORABLE (defun true (X Y) (declare (ignore y)) X) 来源: https://stackoverflow.com

Disable/suppress warning CS0649 in C# for a specific field of class

纵然是瞬间 提交于 2019-12-01 02:39:32
I have some fields in a C# class which I initialize using reflection. The compiler shows CS0649 warning for them: Field foo' is never assigned to, and will always have its default value null' (CS0649) (Assembly-CSharp) I'd like to disable the warning for these specific fields only and still let the warning be shown for other classes and other fields of this class. It is possible to disable CS0649 for the whole project, is there anything more fine-grained? Douglas You could use #pragma warning to disable and then re-enable particular warnings: public class MyClass { #pragma warning disable 0649

suppresing output to console with ruby

此生再无相见时 提交于 2019-11-30 17:15:24
I am writing some unit tests like the following: def executing_a_signal a_method(a_signal.new, a_model, a_helper); assert_equal(new_state, a_model.state) end The tests work fine, but the method which runs just before the assertion to execute the logic prints various messages to the console, mainly via puts . Is there a quick, perhaps built-in, way to suppress that output to the console? I am only interested in the final effect of the method on the model object, and for the sake of keeping the console clean basically, I was hoping to find a way to simply prevent all output to the console

suppresing output to console with ruby

吃可爱长大的小学妹 提交于 2019-11-30 16:31:47
问题 I am writing some unit tests like the following: def executing_a_signal a_method(a_signal.new, a_model, a_helper); assert_equal(new_state, a_model.state) end The tests work fine, but the method which runs just before the assertion to execute the logic prints various messages to the console, mainly via puts . Is there a quick, perhaps built-in, way to suppress that output to the console? I am only interested in the final effect of the method on the model object, and for the sake of keeping the

Java Deprecated APIs and SuppressWarnings “deprecation” - practical approach

谁说我不能喝 提交于 2019-11-30 14:20:37
I have seen many examples of using the Deprecated annotation on APIs in order to mark them as 'need to be replaced soon'. However, in almost all of these cases the code developers not only kept using the deprecated APIs, but also suppressed the deprecation warning . It seems like the best intentions of the API developers end up creating more code which is irrelevant to the implemented business logic - if an API is deprecated but is continually used with the associated warnings being suppressed it seems like a degradation of the code at best and a potential application breaking point when

Avoid MATLAB startup warning when overloading buildin functions?

此生再无相见时 提交于 2019-11-30 14:07:38
As described here , I created my own figure.m which nicely overloads the built-in figure command. Now, whenever I start MATLAB I get the warning Warning: Function C:\somepath\figure.m has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict. Is there any way to deactivate this warning, given that it is desired behavior in my case? You might say that I should call my function differently instead of overloading, but I do feel for my development system this overloading is the right way to go... Update As mentioned by Aabaz you can globally turn