suppress-warnings

suppresing output to console with ruby

Hello, I am writing some unit tests in ruby and have 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 (m...

What is the best way to eliminate MS Visual C++ Linker warning : "warning LNK4221" ?

I have a CPP source file that uses #if / #endif to compile out completely in certain builds. However, this generates the following warning. warning LNK4221: no public symbols found; archive member will be inaccessible I was thinking about creating a macro to generate a dummy variable or function that wouldn't actually be used so this...

Suppress deprecated import warning in Java

In Java, if you import a deprecated class: import SomeDeprecatedClass; You get this warning: The type SomeDeprecatedClass is deprecated Is there a way to suppress this warning? ...

How to suppress GCC warnings from library headers?

I have a project that uses log4cxx, boost, etc. libraries whose headers generate lots of (repetitive) warnings. Is there a way to suppress warnings from library includes (i.e. #include <some-header.h>) or includes from certain paths? I'd like to use -Wall and/or -Wextra as usual on project code without relevant info being obscured. I cur...

Suppress T-SQL warnings generated by IGNORE_DUP_KEY

Is there a way to suppress warnings generated by inserting duplicate keys on indexes with IGNORE_DUP_KEY = ON? The warning it gives is "Duplicate key was ignored." I am investigating using this option with a table variable for performance reasons, but it generates a lot of warning messages. This can be a problem since I log the output...

What compiler warnings should I switch off?

I am refactoring java 1.3 legacy code, around 700 classes. Due to the lack of generics in this code I see currently thousands of warnings, which of them should I simply disable? I don't wan't to discuss of every single warning, just a rule of thumb in terms of groups displayed in eclipses the errors/warnings dialog. ...

Catching warnings pre-python 2.6

In Python 2.6 it is possible to suppress warnings from the warnings module by using with warnings.catch_warnings(): warnings.simplefilter("ignore") fxn() Versions of Python before 2.6 don't support with however, so I'm wondering if there alternatives to the above that would work with pre-2.6 versions? ...

SuppressMessage in interface

Hi, I tried to suppress a particular FxCop warning for a method defined in an interface by adding SuppressMessage attribute to the method. But the warning still appears. I know the SuppressMessage attribute is the right choice. public interface ICustomerAccess { [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", ...

Overriding Object.Equals() instance method in C#; now Code Analysis / FxCop warning CA2218: "should also redefine GetHashCode". Should I suppress this in my case?

I've got a complex class in my C# project on which I want to be able to do equality tests. It is not a trivial class; it contains a variety of scalar properties as well as references to other objects and collections (e.g. IDictionary). For what it's worth, my class is sealed. To enable a performance optimization elsewhere in my system...

How to suppress warnings in external headers in Visual C++

I'm starting a new BREW project, and I'd like to compile with Warning Level 4 (/W4) to keep the application code nice and clean. The problem is that the BREW headers themselves don't compile cleanly with /W4. In gcc you can differentiate between application and system headers by using -I and -isystem, and then by default gcc doesn't rep...

How to suppress Flash migration warnings (1090)

In Flash Professional CS4, I get "migration issue" warnings when I use mouse/keyboard input handler names such as onMouseDown, onKeyUp, etc., even though I have added event listeners for them. These names are perfectly legal for functions, but since these were automatically fired in ActionScript 2.0, we are now (albeit sensibly) warned t...

How to suppress a compiler warning in C# without using #pragma ?

Hi, I need to suppress a specfic compiler warning in C#. Now I can do it like this: #pragma warning disable 0649 private string _field; #pragma warning restore 0649 Is there a way to do it like the following? [SuppressCompilerWarning("0649")] private string _field; Because I only need to suppress warnings for this field, not a ...

supress warning for generated c# code

I have turned on "Treat warnings as errors" for my VS project which mean that I get errors for missing documentation (nice reminder for this particular project). However, part of the code is generated by a custom tool which does not insert xml documentation so I'm looking for away to ignore the missing xml documentation for the generate...

Suppress warnings in Zend Studio

In Eclipse writing Java, it's easy to suppress warnings on some scopes, by annotating a method or variable within the IDE. Is it possible to suppress warnings at scopes while writing PHP within Zend Studio 7.0? ...

kill unsigned / signed comparison error

In general, I want warnings of unsigned vs signed. However, in this particular case, I want it suppressed; std::vector<Blah> blahs; for(int i = 0; i < blahs.size(); ++i) { ... I want to kill this comparison. Thanks! (using g++) ...

Javascript style objects in Objective-C

Background: I use a ton of NSDictionary objects in my iPhone and iPad code. I'm sick of the verbose way of getting/setting keys to these state dictionaries. So a little bit of an experiment: I just created a class I call Remap. Remap will take any arbitrary set[VariableName]:(NSObject *) obj selector and forward that message to a funct...

Avoid warning 'Unreferenced Formal Parameter'

I have a super class like this: class Parent { public: virtual void Function(int param); }; void Parent::Function(int param) { std::cout << param << std::endl; } ..and a sub-class like this: class Child : public Parent { public: void Function(int param); }; void Child::Function(int param) { ;//Do nothing } When I ...

Disabling a specific warning in a specific line in XCode

I'm writing an iPhone app against the Base 4.0 SDK, but I'm targeting OS 3.1.3 so OS 3 users can use the app. I call: [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]; which is deprecated in iOS 4.0. I'm aware of this, and have measures in place to call the newer "withAnimation" version if we are running under ...

How to get the workaround for GCC warning, "the address of XXX will never be NULL"?

Hi, all. I'm working on C program. There is a function which takes two pointer argument and does some complex works. Let's say it as 'cmp'. cmp() is never complex for the illustrative reason. int cmp(struct foo *a, struct foo *b) { return (a->bar == b->bar); } I'd like to make a NULL-check macro, like this: #define SAFE_CMP(a,b...

When do I suppress warnings to source vs. Project Suppression File

I'm working on resolving about 300 warnings and some of the warnings are unnecessary and can be suppressed. However, my question is do I suppress them in the Source - an attribute is added above the method - Or do I suppress them in teh GlobalSuppressioins.cs? Is there any guidance for this, if so where? Thanks ...