suppress-warnings

Function checking if an integer type can fit a value of possibly different (integer) type

梦想的初衷 提交于 2019-11-30 13:19:52
问题 Is it possible to create a templated function that checks if a primitive data type can fit a value of potentially different primitive data type? Let's limit the scope to integer types for the moment. More precisely: Is it possible to create a "one fit all" templated functions yet without getting compiler warnings (boolean expression always true/false, signed/unsigned comparison, unused variable) and without disabling compiler warning checks? The functions should also limit as much as possible

Suppress “variable is never assigned” warning in IntelliJ IDEA

青春壹個敷衍的年華 提交于 2019-11-30 12:25:05
问题 We use reflection extensively to set class field values in our code. The fields are accessed in code but they are never assigned except via reflection. So IDEA displays "is never assigned" warning. If I ask IDEA to suppress the inspection, it inserts @SuppressWarnings({"UnusedDeclaration"}) but this also disables the check of whether the field is used or not, which we do not want. Is it anyhow possible to disable only "not assigned" check and leave "not used" check for specific fields only?

clang-tidy: How to suppress warnings?

跟風遠走 提交于 2019-11-30 11:47:24
I recently started experimenting with the clang-tidy tool of llvm. Now I am trying to suppress false warnings from third party library code. For this I want to use the command line options -header-filter=<string> or -line-filter=<string> but so far without success. So for people with limited time I will put the question here at the beginning and explain later what I already tried. Question What option do I need to give to the clang-tidy tool to suppress a warning from a certain line and file? if this is not possible What option works to suppress warnings from external header files? What I did

Partially disable pedantic warnings in gcc within source

馋奶兔 提交于 2019-11-30 11:43:05
I am trying to get gcc to shut up about my usage of binary constants. They make the code more readable, but prevent me from using -pedantic which I comply with otherwise. I would either like to have a switch like -fnobinaryconstwarn or similar (which I don't think exists after perusing the man page for a while) or use a #pragma GCC diagnostic ignored "-pedantic" to selectively disable the pedantic warnings for a short stretch like described here: Selectively disable GCC warnings for only part of a translation unit? Unfortunately that doesn't seem to work. What are my options? For clang #pragma

Is there a possibility to pass includes via -isystem when using qmake

大憨熊 提交于 2019-11-30 09:31:09
I use qmake as a makefile builder and want to stick to it. Further I would like to use "gcc -Wall -Werror -Wundef -Wextra" to get robust code. I'm thinking about "-pedantic" but that's further up the road. My main problem at the moment are the tons of warnings generated by libraries like boost, parts of qt and the like. At the moment I use pragmas whenever I include warning-generating headers #pragma GCC diagnostic ignored "-Wall" #include <QtGui> ... #include <QWidget> #pragma GCC diagnostic error "-Wall" This is far from cute, rather tedious and cumbersome especially as other programmers

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

元气小坏坏 提交于 2019-11-30 08:54:08
问题 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? 回答1: You could use #pragma warning to

Unsupported @SuppressWarnings(“PMD.DoNotCallSystemExit”)

谁都会走 提交于 2019-11-30 07:49:27
I need to use System.exit(0) in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit") remove that warning but now I get a warning that this SuppressWarnings is unsupported, despite the fact that it works. Is there a way to resolve this? user342495 To get Eclipse to not flag the @SuppressWarnings("PMD") annotation, look under the menu headings Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Token in '@SuppressWarnings' and set it to ignore. Right on the PMD page. 来源: https://stackoverflow

Is it alright to suppress/hide PHP notices?

廉价感情. 提交于 2019-11-30 06:14:42
I've suppressed notices for quite some time with no problems whatsoever but I am beginning to wonder if I'm doing the right thing. I can't seem to find any logical reason why I shouldn't just suppress them but some other people seem to think that suppressing them using error_reporting is a horrible thing to do, but why? The closest thing to an answer I could find was in this question but that's still far from the answer I'm looking for. Is there some sort of unforeseen downside to hiding all the notices that PHP generates? For example, to include a variable from a POST call back into the form

@SuppressWarnings(“serial”)

天大地大妈咪最大 提交于 2019-11-30 04:48:52
I have a question because I'm getting a little confused (or maybe I'm not noticing something obvious). Let's say that I've got some source code that contains a lot of classes which contain a great number of static fields defined like this one: public final class ConverterTYPE { private final static HashMap<String, Byte> STRING_MAP = new HashMap<String, Byte>() { { put("A", new Byte((byte)12)); put("B", new Byte((byte)13)); } }; } As we all know, static fields are not going to be serialized. However, Java (and Eclipse) complains that "The serializable class does not declare a static final

Suppress “variable is never assigned” warning in IntelliJ IDEA

ぃ、小莉子 提交于 2019-11-30 03:04:11
We use reflection extensively to set class field values in our code. The fields are accessed in code but they are never assigned except via reflection. So IDEA displays "is never assigned" warning. If I ask IDEA to suppress the inspection, it inserts @SuppressWarnings({"UnusedDeclaration"}) but this also disables the check of whether the field is used or not, which we do not want. Is it anyhow possible to disable only "not assigned" check and leave "not used" check for specific fields only? IDEA version is 10.5 You could use an annotation to mark it as an injected field. (similar to how it