compiler-warnings

Raw Type Warning in Android Studio

二次信任 提交于 2019-12-08 18:58:17
问题 Android Studio doesn't show a compiler warning when using the raw type in referencing a generic type. Is there a way to enable this feature? public class GenericClass<T> { } public class SpecificClass extends GenericClass { } Eclipse usually shows the following warning: GenericClass is a raw type. References to generic type GenericClass <T> should be parameterized. 回答1: You can enable the warning but cant force it as compilation error. Same is the case in Eclipse[see tail for the update]. You

More robust AC_COMPILE_IFELSE feature testing?

我的梦境 提交于 2019-12-08 18:03:41
问题 Autoconf's AC_COMPILE_IFELSE is misdetecting features for us under different compilers, like Sun's C++ compiler and IBM's xlC compiler. AC_COMPILE_IFELSE appears to check return values, but some compilers don't bother to set it or set it to unexpected values. Later, we use options that are not available. In my non-Autoconf build scripts I use "fatal|error|illegal|unrecognized|not found|not exist" to detect a compiler or linker complaint. It is more robust than just checking $? . The test

g++ C++0x enum class Compiler Warnings

夙愿已清 提交于 2019-12-08 16:45:35
问题 I've been refactoring my horrible mess of C++ type-safe psuedo-enums to the new C++0x type-safe enums because they're way more readable. Anyway, I use them in exported classes, so I explicitly mark them to be exported: enum class __attribute__((visibility("default"))) MyEnum : unsigned int { One = 1, Two = 2 }; Compiling this with g++ yields the following warning: type attributes ignored after type is already defined This seems very strange, since, as far as I know, that warning is meant to

How to stop warning for UIView may not respond to selector

岁酱吖の 提交于 2019-12-08 16:19:40
问题 I have a class that has a UIView as a property. Sometimes I pass in a UILabel; sometimes a UITextField. No matter which I pass in, I want the class to set the text. Currently I am doing this, which works: if ([self.viewToUpdate respondsToSelector:@selector(setText:)] && !self.newAnswer) [self.viewToUpdate setText:[[self.choices objectAtIndex:indexPath.row] text]]; The problem is, this gives a warning, because even though I'm checking respondsToSelector , Xcode doesn't know that my UIView will

Warnings from boost

≡放荡痞女 提交于 2019-12-08 08:03:32
问题 I have lots of warning from boost library headers, is there any way to resolve this problem? libs/boost/include/boost/numeric/ublas/detail/vector_assign.hpp:382:39: warning: typedef ‘reference’ locally defined but not used [-Wunused-local-typedefs] typedef typename V::reference reference; libs/boost/include/boost/numeric/ublas/detail/vector_assign.hpp:516:40: warning: typedef ‘value_type’ locally defined but not used [-Wunused-local-typedefs] typedef typename V::value_type value_type; libs

“value returned is unused” warning when byte-compiling a macro

邮差的信 提交于 2019-12-07 22:30:05
问题 Why does byte-compiling the the following produce a warning? (defmacro foomacro (shiftcode) `(defun foo (&optional arg) (interactive ,(concat shiftcode "p")) (message "arg is %i" arg)) `(defun bar (&optional arg) (interactive ,(concat shiftcode "Nenter a number: ")) (message "arg is %i" arg))) ;; provide backward compatibility for Emacs 22 (if (fboundp 'handle-shift-selection) (foomacro "^") (foomacro "")) This is the warning I get: $ emacs -Q --batch --eval '(byte-compile-file "foo.el")' In

Java eclipse highlight missing brackets

北战南征 提交于 2019-12-07 20:03:59
问题 I just can't find the option anywhere. Is there some way in eclipse to warn about stuff like this? if(a==b)continue; instead of if(a==b){continue;} Or can maybe the format function fix this? 回答1: CheckStyle is a nice tool which can also be used as a plugin for eclipse. You can specify different kinds of coding styles you want to enforce on you / your team, by configuring rules in this tool. This could help you create your custom check. 回答2: Window-->Preferences--> Java > Editor > Save Actions

Potential null pointer access

别来无恙 提交于 2019-12-07 18:04:43
问题 I encounter a strange situation that is currently not that clear to me: When having the potential null pointer access warning enabled in Eclipse, I get warnings like in the following (the warnings are stick to the line preceding the corresponding comment): protected Item findItemByName(String itemName, Items items) { boolean isItemNameMissing = null == itemName || itemName.isEmpty(); boolean isItemsMissing = null == items || null == items.getItems() || items.getItems().isEmpty(); if

How to figure out which Xlint option corresponds to a compiler warning?

可紊 提交于 2019-12-07 15:02:16
问题 My software builds use -Xlint -Werror so I routinely run across compiler warnings that break my build. Every once in a while I run across a warning that I need to suppress, but it's always difficult to figure out which Xlint option suppresses the warning I am seeing. I'll give you a concrete example. I recently ran across: [WARNING] module-info.java:[16,106] module not found: org.bitbucket.cowwoc.requirements.guava I searched the JDK 11 source-code and discovered this warning message declared

Why is C4062 Visual C++ warning off by default?

爷,独闯天下 提交于 2019-12-07 10:23:15
问题 According to MSDN, Visual C++ can emit C4062 warning when and enumeration is used in switch and there's no label for at least one element of that enumeration and there's no default: label in the switch Now to me such situation certainly deserves a warning - there's a good chance that the element in question is mishandled. If nothing has to be done for some elements - the developer can provide either an empty case or default . What could be the reason why this warning is off by default? 回答1: