compiler-warnings

C# Compiler Warning 1685

给你一囗甜甜゛ 提交于 2019-11-28 08:52:11
So, (seemingly) out of the blue, my project starts getting compiler warning 1685: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' Perplexed, I researched the MSDN article to figure out its cause. Here's the information I found: Visual C# Reference: Errors and Warnings Compiler Warning (level 1) CS1685 Error Message The predefined type 'System.type name' is defined in multiple assemblies in the global alias; using

GCC does not honor 'pragma GCC diagnostic' to silence warnings [duplicate]

折月煮酒 提交于 2019-11-28 08:08:32
This question already has an answer here: Suppress -Wunknown-pragmas warning in GCC 1 answer We recently enabled -Wall for a project. Its enabled when GCC is at 4.7 or above (or Clang) because we can use GCC diagnostic to manage the output from the elevated warnings. We want to manage them from the source code, and not via command line arguments. (We don't want to pollute the command line, or ask library users to rediscover what is needed). Under GCC 4.8 and 5.1, we are catching warnings that were disabled in a GCC diagnostic block for -Wunused-variable , -Wunused-value , -Wunused-function and

Boolean expression order of evaluation in Java?

有些话、适合烂在心里 提交于 2019-11-28 08:06:43
Suppose I have the following expression String myString = getStringFromSomeExternalSource(); if (myString != null && myString.trim().length() != 0) { ... } Eclipse warns me that myString might be null in the second phrase of the boolean expression. However, I know some that some compilers will exit the boolean expression entirely if the first condition fails. Is this true with Java? Or is the order of evaluation not guaranteed? However, I know some that some compilers will exit the boolean expression entirely if the first condition fails. Is this true with Java? Yes, that is known as Short

PerformSelector warning

前提是你 提交于 2019-11-28 07:44:04
I'm receiving a warning PerformSelector may cause a leak because its selector is unknown In the code: - (void) callDelegate: (SEL) selector withArg: (id) arg error: (NSError*) err { assert([NSThread isMainThread]); if([delegate respondsToSelector: selector]) { if(arg != NULL) { //this line the warning [delegate performSelector: selector withObject: arg withObject: err]; } else { //this line the warning [delegate performSelector: selector withObject: err]; } } else { NSLog(@"Missed Method"); } } Header: @interface Topscore : UIViewController <NSObject> { // } This is a warning generated by the

Universally compiler independent way of implementing an UNUSED macro in C/C++

旧巷老猫 提交于 2019-11-28 07:34:45
When implementing stubs etc. you want to avoid "unused variable" warnings. I've come across a few alternatives of UNUSED() macros over the years, but never one which either is proven to work for "all" compilers, or one which by standard is air tight. Or are we stuck with #ifdef blocks for each build platform? EDIT: Due to a number of answers with non c-compliant alternatives, I'd like to clarify that I'm looking for a definition which is valid for both C and C++, all flavours etc. sharptooth According to this answer by user GMan the typical way is to cast to void : #define UNUSED(x) (void)(x)

How to use clang++ with -std=c++11 -Weverything -Werror

孤街醉人 提交于 2019-11-28 07:34:40
I want to compile the following file (temp.cpp): #include <iostream> class Foo { public: Foo() = default; }; int main(){ std::cout << "Works!" << std::endl; return 0; } With the following command: clang++ temp.cpp -o temp -std=c++11 -Weverything -Werror There is an error: temp.cpp:5:11: error: defaulted function definitions are incompatible with C++98 [-Werror,-Wc++98-compat] I understand that there is a warning like c++98-compat and it is part of everything. How can I enable all warnings except c++98-compat? Is there a c++11 compatible flag for -Weverything? Actually, you probably do not want

Why >>24 causes -Wconversion but >>23 doesn't?

↘锁芯ラ 提交于 2019-11-28 07:16:00
问题 Here is the code: #include <stdint.h> unsigned char f(uint32_t RGBA) { return (RGBA>>24) & 0xFF; } When compiled with -Wconversion it causes "warning: conversion to ‘unsigned char’ from ‘uint32_t {aka unsigned int}’ may alter its value [-Wconversion]". If I lower the shift value to 23 or less the warning disappears. I've looked through the C99 standard and I don't understand what happens here. If I remove the & operator then the warning is always emitted and that is probably good, as the

How can I suppress javac warnings about deprecated api?

走远了吗. 提交于 2019-11-28 07:08:15
When I compile, javac outputs: Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details.` I wish to suppress this warning. Trying -Xlint:none does not seem to help. Thomas Owens From what I can tell in the docs, you can't do it on the command-line. According to the javac documentation , -Xlint:none only disables warnings "not mandated by the Java Language Specification". It appears that warning you of the use of deprecated APIs is managed by the language spec. Your best option would be to fix the use of deprecated APIs. However, an option

Visual Studio warning level meanings?

假装没事ソ 提交于 2019-11-28 07:06:56
On the build tab in a Web Application project I have a setting called "Warning Level". I can set a value from 0 to 4. What do these values mean? Will a value of 0 be more strict and generate more warnings, or vice versa? I haven't been able to find any documentation on it yet, but perhaps I'm looking in the wrong place. mwigdahl This link shows you the definitions of the warning levels (I'm assuming you are using C# code in your web project). Level 4 is the most strict. 0: Turns off emission of all warning messages. 1: Displays severe warning messages. 2: Displays level 1 warnings plus certain

How to disable a specific nvcc compiler warnings

我只是一个虾纸丫 提交于 2019-11-28 06:30:34
I want to disable a specific compiler warning with nvcc , specifically warning: NULL reference is not allowed The code I am working on uses NULL references are part of SFINAE, so they can't be avoided. An ideal solution would be a #pragma in just the source file where we want to disable the warnings, but a compiler flag would also be fine, if one exists to turn off only the warning in question. user2333829 It is actually possible to disable specific warnings on the device with NVCC. It took me ages to figure out how to do it. You need to use the -Xcudafe flag combined with a token listed on