suppress-warnings

How to find out the number of a C++ warning

本小妞迷上赌 提交于 2019-12-24 02:24:04
问题 I have turned on -Wall in my code to get rid of all warnings. Some however I want to allow within the code, so I disable those ones in code. Of the common ones, I can easily find out the warning number in Google and disable them like e.g.: #pragma warning( disable : 4127 ) But of some, I can't possibly find the corresponding number. For example, I want to disable a: warning : array subscript is of type 'char' [-Wchar-subscripts] How do I find its number? Is there a searchable list? The

Suppress warnings using tryCatch in R

十年热恋 提交于 2019-12-23 14:41:19
问题 What I'm trying to do Write a tryCatch that will handle an error value but will ignore a warning. As an example foo <- function(x) { if (x == 1) { warning('Warning') } else if (x == 0) { stop('Error') } return(1) } bar <- function(x){ tryCatch( expr = foo(x), error = identity, warning = function(w) invokeRestart("muffleWarning") ) } So foo warns you if you pass a 0, and errors if you pass a 1. The intent of bar is that you get an error if you pass a 0, but it suppresses the warning generated

MongoDB: How to disable logging the warning: ClientCursor::staticYield can't unlock b/c of recursive lock?

五迷三道 提交于 2019-12-23 13:15:20
问题 I get the warning stated in the title warning: ClientCursor::staticYield can't unlock b/c of recursive lock ns.... in the log file for literally gazillion of times (the log file reaches 200 GB in size in a single day with this single log message). As mentioned in this SO question, I want to adopt the "solution" of simply ignoring the message. What I did (to no avail) to stop it is to: set the param quiet = true set the param oplog = 0 set the param logpath=/dev/null (hoping that nothing gets

Ignoring all warnings in an Eclipse project

时光总嘲笑我的痴心妄想 提交于 2019-12-23 09:29:07
问题 Suppose that you have a bunch of projects in your Eclipse workspace. Some are Java projects, some may be CDT projects, others may come from third party plugins such as TeXlipse or EPIC. You strive long and hard to produce quality code, yet in one specific project you have a couple of warnings, through no fault of your own - warnings that propagate up the chain to your working set and poke you in the eye. Is there a general way in Eclipse 3.7 to tell the IDE that it should ignore (and be quiet

How to suppress “Can be replaced with foreach call” warning

和自甴很熟 提交于 2019-12-23 07:06:18
问题 I'm using Java 8 with Android Studio and Retrolambda plugin to compile lambdas to anonymous classes (because Java 8 is not supported on Android). The IDE shows me warnings (or tips) how to change my code to use all the features of Java 8. One of these features is "Can be replaced with foreach call" when you loop over collection. I want to suppress this kind of warning, but I can't figure out how to do this. The simplest solution to suppress this kind of warning is the @SuppressWarnings("all")

cc1plus: unrecognized command line option warning on any other warning

亡梦爱人 提交于 2019-12-23 02:38:35
问题 I have a strange behavior of g++ that it shows a warning about unrecognized command line option, when any other warning is shown. Example: struct Foo{virtual int bar() = 0;}; struct Bar:public Foo{int bar() {return 0;} }; int main(){} Compiling with g++-5 -Wsuggest-override -Wno-c99-extensions -std=c++11 a.cpp or even g++-5 -Wsuggest-override -Wno-c99-extensions a.cpp shows: a.cpp:2:27: warning: ‘virtual int Bar::bar()’ can be marked override [-Wsuggest-override] struct Bar:public Foo{int bar

How to avoid having to use @SuppressWarnings(“unchecked”)?

北慕城南 提交于 2019-12-22 17:55:06
问题 I have a Cache object for persisting objects to disk, and the way I've implemented this causes me to have to use @SupressWarnings . I'm not a Java expert, but this seems like a code smell, and I'm wondering if there's a 'better' way to do what I'm doing here (for instance, somehow storing a Type when I write the cache, and reading this value to be able to instantiate a specific type?). My Cache object looks like this (not-relevant code removed for brevity): /** * Write object o to cache file

Suppress FindBugs warnings in Eclipse

爱⌒轻易说出口 提交于 2019-12-22 10:49:07
问题 I am using a string as a lock and so want to ensure the object is a new instance. FindBugs complains because it's generally more efficient to define the string directly (with double quotes). My code looks like: /** A lock for the list of inputs. */ @edu.umd.cs.findbugs.annotations.SuppressWarnings("DM_STRING_CTOR") //We want a new String object here as this is a lock. private final Object inputListLock = new String("inputListLock"); Am I doing something wrong here? The Eclipse FindBugs plugin

Suppress Xml warning for ServiceReference .cs file

隐身守侯 提交于 2019-12-22 04:59:15
问题 Working with MVC4 and VS2012 , I am using a Service Reference , which auto generates a Reference.cs file. When I build, I get dozens of warnings as errors that read 'Missing XML comment for publicly visible type or member...' I have found a similar answer here, which references a workaround found in this blog, which suggests adding the following fix into the CSProj file: <Target Name="XamlGeneratedCodeWarningRemoved" AfterTargets="XamlMarkupCompilePass1"> <Exec Command="for %%f in (@

Suppress warnings in PyDev

耗尽温柔 提交于 2019-12-21 09:25:16
问题 I use the following at the beginning of all modules in my Python project: import setup_loggers setup_loggers is a module that does exactly that. The import statement makes sure that no matter which module is loaded first, the loggers are setup and ready. However, as I don't use setup_loggers module later in the file, I receive a PyDev warning (a small yellow marker). I get this warning for all my modules, thus it blocks me from seeing other warnings in the PyDev Package Explorer. Is there a