suppress-warnings

How to suppress Java warnings for specific directories or files such as generated code

拥有回忆 提交于 2019-11-27 10:35:16
I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generated source files. I know I can use the @SuppressWarning annotation to suppress particular warnings in particular elements, but any annotations I add by hand will be lost when the parser generator runs again. Is there a way to configure Eclipse to suppress warnings for a particular file or directory? Starting with version 3.8 M6, Eclipse (to be exact: the JDT) has built-in functionality for this. It is configurable through a project's build path: Project

Suppression files for Qt memory leaks with Valgrind

独自空忆成欢 提交于 2019-11-27 06:50:10
问题 I usually write my classes in C++ and check if they leak memory using valgrind on Linux platform. I'm not satisfied until all the heap memory is freed. Starting to write in Qt, I found how many leaks valgrind detects, also on a simple project. They are so many that it's difficult to detect my same leaks. I read somewhere that is possibile to use a suppression files for valgrind which helps filtering out the unwanted leaks, but I can't find it. I'm using Ubuntu 11.04 x64, g++ 4.5, Qt 4.7. Does

How to suppress FindBugs warnings for fields or local variables

你。 提交于 2019-11-27 06:34:46
问题 I would like to suppress FindBugs warnings for specific fields or local variables. FindBugs documents that the Target can be Type, Field, Method, Parameter, Constructor, Package for its edu.umd.cs.findbugs.annotations.SuppressWarning annotation [1]. But it does not work for me to annotate the field, only when I annotate the method the warning gets suppressed. Annotating a whole method seems to broad to me. Is there any way to suppress warnings on specific fields? There is another related

Suppress -Wunknown-pragmas warning in GCC

安稳与你 提交于 2019-11-27 05:53:42
问题 I try to ignore warnings coming from some 3rd party header files like this: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC diagnostic ignored "-Wreorder" #include <some_3rd_party_header.h> #pragma GCC diagnostic pop This approach seems to work in general, but not for the unknown pragma warnings (I still get them). Why does it work for other warnings but not for this one? Can anyone confirm this behaviour? I'm using g++ (version 4.7.1) with -Wall and

How to suppress Java compiler warnings for specific functions

守給你的承諾、 提交于 2019-11-27 05:49:56
问题 We are always taught to make sure we use a break in switch statements to avoid fall-through. The Java compiler warns about these situations to help us not make trivial (but drastic) errors. I have, however, used case fall-through as a feature (we don't have to get into it here, but it provides a very elegant solution). However the compiler spits out massive amounts of warnings that may obscure warnings that I need to know about. I know how I can change the compiler to ignore ALL fall-through

What does casting to `void` really do?

穿精又带淫゛_ 提交于 2019-11-27 04:29:05
An often used statement like (void)x; allows to suppress warnings about unused variable x . But if I try compiling the following, I get some results I don't quite understand: int main() { int x; (short)x; (void)x; (int)x; } Compiling this with g++, I get the following warnings: $ g++ test.cpp -Wall -Wextra -o test test.cpp: In function ‘int main()’: test.cpp:4:13: warning: statement has no effect [-Wunused-value] (short)x; ^ test.cpp:6:11: warning: statement has no effect [-Wunused-value] (int)x; ^ So I conclude that casting to void is very different from casting to any other types, be the

Suppress InsecureRequestWarning: Unverified HTTPS request is being made in Python2.6

本小妞迷上赌 提交于 2019-11-27 02:33:19
I am writing scripts in Python2.6 with use of pyVmomi and while using one of the connection methods: service_instance = connect.SmartConnect(host=args.ip, user=args.user, pwd=args.password) I get the following warning: /usr/lib/python2.6/site-packages/requests/packages/urllib3/connectionpool.py:734: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning) What's interesting is that I do not have urllib3 installed with pip (but it's there in /usr/lib

Ignore divide by 0 warning in NumPy

蹲街弑〆低调 提交于 2019-11-27 01:46:45
问题 I have a function for statistic issues: import numpy as np from scipy.special import gamma as Gamma def Foo(xdata): ... return x1 * ( ( #R is a numpy vector ( ((R - x2)/beta) ** (x3 -1) ) * ( np.exp( - ((R - x2) / x4) ) ) / ( x4 * Gamma(x3)) ).real ) Sometimes I get from the shell the following warning: RuntimeWarning: divide by zero encountered in... I use the numpy isinf function to correct the results of the function in other files, so I do not need this warning. Is there a way to ignore

Java 6: Unsupported @SuppressWarnings(“rawtypes”) warning

会有一股神秘感。 提交于 2019-11-27 01:33:57
问题 I moved to a new machine which has the latest Sun's Java compiler and noticed some warnings in the existing Java 6 code. The Eclipse IDE, suggested that I annotate the assignment with: @SuppressWarnings("rawtypes") For example: class Foo<T> { ... } ... @SuppressWarnings("rawtypes") Foo foo = new Foo(); When I moved back to the machine with the older compiler (JDK 1.6.0_20), I have noticed that this older compiler now warns about the suppression of "rawtypes" warnings, claiming that this

Is there a way to ignore a single FindBugs warning?

无人久伴 提交于 2019-11-27 00:00:37
With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored. Is there something similar for FindBugs? Pascal Thivent The FindBugs initial approach involves XML configuration files aka filters . This is really less convenient than the PMD solution but FindBugs works on bytecode, not on the source code, so comments are obviously not an option. Example: <Match> <Class name="com.mycompany.Foo" /> <Method name="bar" /> <Bug pattern="DLS_DEAD_STORE_OF_CLASS_LITERAL" /> </Match> However, to solve this issue, FindBugs later introduced another solution based on