Questions tagged [compiler-warnings]

1

votes
2

answer
45

Views

nvcc warns about a device variable being a host variable - why?

I've been reading in the CUDA Programming Guide about template functions and is something like this working? #include /* host struct */ template struct Test { T *val; int size; }; /* struct device */ template __device__ Test *d_test; /* test function */ template T __device__ testfunc() { retur...
Herzog Igzorn
1

votes
2

answer
290

Views

GitLab CI: How to fail on new compiler warnings

We are trying to get an old legacy code base under control while simultaneously developing new features. Currently the code compiles with a hell of a lot of compiler warnings and warnings from static code analyzers. For that reason it is not uncommon that code introducing new warnings reaches produc...
sigy
1

votes
1

answer
107

Views

C++ Give compiler error for setting a (static) const global variable to another static const variable

Is it possible for clang to give a compiler error if you accidentally set a const global variable to another static const variable in C++ (in different translation units). Since the behaviour is pretty much undefined, it would be very useful to detect if doing this accidentally. EDIT: My question is...
keyboard
1

votes
0

answer
107

Views

How to filter c++ compiler warnings after the fact

I routinely submit R libraries with a C++ component to a third party repository (CRAN) that compiles them on various platforms and distributes the binaries to users. I do not control the compiler flags used on all the platforms. From time to time the different compilers on this platform find bugs i...
Steven Scott
1

votes
0

answer
21

Views

Creating a universal binary using Intel compiler

In MacOSX, gcc command line accepts multiarchitecture options: gcc -arch i386 -arch x86_64 etc. ... and creates a universal binary by compiling and linking for both archs and running lipo for gluing them together. However using this command line with Intel, produces a compiler warning: command line...
gil_mo
1

votes
1

answer
68

Views

How can I fix these mismatches?

Used GCC: Linaro-GCC 4.7/4.8/4.9.3/6.4/7.3 but version seems to be meaningless OS: updated Linux Mint 19 and 4.17.2-ext73-57.2 kernel. I have tried to compile a few sources (e.g. official LineageOS source) and everytime I got that: WARNING: vmlinux.o(.data+0x10f40): Section mismatch in reference fro...
User9123
1

votes
0

answer
116

Views

Is there a `clang++:-Wunused-lambda-capture` equivalent warning in/being developed for GCC?

Background I sometimes run into code that use the following dummy lambda-capture (instead of e.g. (void)x;, ... foo(int /* x */) or ... foo([[maybe_unused]] int x) in C++17) in order to remedy an unused variable warning: void foo(int bar) { [&x]{}(); } Now, this is not really a remedy, as it passes...
dfri
1

votes
0

answer
47

Views

Instance method takes long time for type-cheking

I have quite a big project that takes a long time to compile. When I checked compilation times of methods. I found that this method, for example, takes usually more than 200ms to compile. What can I do to improve this? func processSnapshot(snapshot:DataSnapshot) { self.numberOfUsers.text = '#Total D...
Marc Fdn
1

votes
1

answer
129

Views

Clang -Wconditional-uninitialized on struct member array assignment

I've run into some unusual behavior involving Clang -Wconditional-uninitialized. Consider the following example: typedef struct { int x[1]; } test_t; test_t foo(void); test_t foo() { test_t t; for(int i = 0; i < 1; i++) t.x[i] = 0; return t; } int main() { } Compiling with, e.g. clang -o test -Weve...
EE_
1

votes
0

answer
110

Views

three.js line:17299:4 warning X4121 - how can this be prevented to “improve performance”?

I'm getting this warning in Firefox console (F12): and in Chrome too: What should I do to prevent this warning and 'improve performance'? EDIT: the following three.js examples raise the same warning: animation / cloth postprocessing / outline postprocessing / sao postprocessing / ssao physics /...
user5515
1

votes
2

answer
2k

Views

Using '!' here is deprecated and will be removed in a future release - swift 4.2

Compiler throwing following warning when setting image in a cell using SDWebimage in Swift 4.2. Swift Compiler warning : Using '!' here is deprecated and will be removed in a future release let url = NSURL(string: (str_url) as String) cell.img!.sd_setImage(with: url as URL!, completed: block_image)...
imgroot
1

votes
2

answer
45

Views

Android Room Bug in Kotlin

I think the is a semantic issue in Room while working in Kotlin. Simple DAO query in Room can be obtained by @Query('SELECT * FROM Users WHERE id = :id') fun getUser(id: Int): User Although, I defined return type as User, not User?, this query can still returns null, when there is no User with the g...
musooff
1

votes
1

answer
26

Views

Warning message saying the '.credentials' folder can't be found and Safari won't load 'localhost'

I am trying out the Google Drive API (in Python) for a project of mine. I have setup an API, and am using the Python Quickstart API Code (No modifications at all). When I try and run the code, I get a warning message in the Python console saying UserWarning: Cannot access /Users/everyone/.credenti...
DreamingInsanity
1

votes
0

answer
39

Views

Get compilation warning at correct position (`gcc`)

In this example powered by Godbolt, and reproduced below, it's possible to create a function which requires its parameters to respect some conditions (i >= 0), ptr != NULL, etc. // EXPECT() : will trigger a warning if the condition is not guaranteed #define EXPECT(c) (void)((c) ? (void)0 : never_re...
Cyan
1

votes
2

answer
460

Views

Xcode - why didn't this show a warning?

I've got a class I wrote earlier in the year, pre 3.0, that implemented the UIImagePickerControllerDelegate protocol. In it, I implemented the imagePickerController:didFinishPickingImage:editingInfo: method, which is deprecated in the 3.0 SDK. The thing is, I noticed this just by cruising through t...
bpapa
1

votes
4

answer
2.9k

Views

“warning: '<CLASS>'may not respond to '<[-|+]FUNCTION>'” Objective C/Xcode Compiler Warnings

I figured this one out, yet thought it worthy of its own question answer pair. I'm new to Xcode and Objective C, and getting to know its varied eccentricities. For instance, the compiler warning 'warning: ''may not respond to ''' appears when I try to compile the following code, which all appears in...
EC_Johnson2000
1

votes
3

answer
2.8k

Views

MSBuild 4 fails to build VS2008 csproj due to 1 compiler warning

We have a VS2008 CS DLL project targeting .NET 3.5. It builds successfully on our CI server when using MSBuild 3.5. When CI is upgraded to use MSBuild 4.0, the same project fails to build, due to 1 warning message: c:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1418,9): warning MS...
David White
1

votes
3

answer
267

Views

How can I retain compiler warnings in Hudson (CI) when using SVN Update?

I've got a continuous integration setup using Hudson and lately I've configured the jobs to use svn update to get the latest version of the code. I really like this approach since it allows msbuild to version appropriately and only build the effected assemblies. However, I've noticed that since I'm...
Allen Rice
1

votes
5

answer
2.3k

Views

Tool for removing unused local variables in Fortran code

Is there some good tool for removing unused local variables from free form Fortran code? The background is that we have a codebase which is very large, and unused warnings has been disabled for the last 20 years, so there are quite a lot of them, too many to fix manually. I know Photran has that kin...
Jan Mattsson
1

votes
1

answer
761

Views

Intellij Idea does not display javac compiler warnings of referencing proprietary API

I'm working with Intellij Idea 10 and Java 6 JDK Update 7. When I run Build --> Rebuild Project command, the javac compilation (using parameter -Xlint:all) displays warnings, but for some reason does not include warnings about the source code referencing Sun proprietary API classes. When I run javac...
Tommi
1

votes
1

answer
1.9k

Views

Eclipse (Java): Central “treat warnings as errors”

Is there a way to enable treat 'treat warnings as errors' (or something similar that has the same effect) from a central location in eclipse? I have already found Project Properties -> Errors/Warnings where I can change the error level for each individual warning (with corresponding effect in the Pr...
Johannes Rudolph
1

votes
1

answer
1.7k

Views

gcc optimization affects bounds checking

Consider the following example: int a[4]; int main() { a[4] = 12; //
bitmask
1

votes
2

answer
144

Views

Hudson and build warnings: possible to exclude a project from reporting?

I'd like Hudson to send an e-mail to developers whenever a warning is encountered in the build (VS2010, TFS) The problem is that the solution contains several projects from another company that we cannot touch. Since they are part of the solution, they need to be built when the solution is built, bu...
Peter Polák
1

votes
3

answer
279

Views

Restructure code block so that Unused warning is eliminated

Having inherited a project from an Outsourced development company, I've been asked to modify the application and add some features. Being a bit of a perfectionist (but still relatively new) I'm trying to eliminate Warnings from the Project when I compile. I'm getting this error Unused variable 'time...
Paul Farry
1

votes
3

answer
5.8k

Views

OpenCV 2.3 in Embarcadero C++ Builder

When compiling a OpenCV 2.3 project in Builder I get multiple errors starting with '_fm_atan2l is not a member of 'std'' and continuing with other math related errors in that form. I also get 'Multiple declaration of '_Ctraits::_Isnan(double)' and other similar errors. This happens after I simply...
user912447
1

votes
2

answer
629

Views

Uninitialized warning with GCC optimizer

I implemented a tree in C, and I now want to define a wrapper tree set. I have an iterator for my tree in tree.h: typedef struct tree_iter_t { void *current; tree_t *tree; unsigned char info : 2; } tree_iter_t; and a function to get an iterator in tree.c: tree_iter_t titerator(tree_t *t) { tree_iter...
Nick
1

votes
2

answer
1.5k

Views

unresolved external symbol compile error

I frequently have this problem when I try a new library. This time I work with PointGrey Camera and try to use its API libraries (some dll, lib, header files). Mostly, problems were fixed by configuring the SDK (I'm using VS2008) Tools/Options/VC++ Directories/include files(/library files)(/executab...
TSL_
1

votes
2

answer
95

Views

How can I make the objective-c compiler assume undeclared properties are dynamic?

I'd like to be able to write id foo = [MyObject new]; foo.bar = [NSObject new]; But I get the following error: /blah/blah/blah/Blah.m:32:9: error: property 'bar' not found on object of type '__strong id' foo.bar = [NSObject new]; ^ 1 error generated. Since clang doesn't report a warning I could supp...
Heath Borders
1

votes
1

answer
993

Views

-Wundef and -Werror=undef aren't working together in MinGw 4.4.1

According to the GCC documentation -Wundef emits a warning when an undefined identifier is used in a #if directive and -Werror= displays the specified warning as error But they are not working together in MinGW 4.4.1. Although -Wundef works and -Werror (to display all warnings as error) work. Is thi...
Shreyas S
1

votes
1

answer
1.6k

Views

#pragma warning(default: all)

Is there an easy way to accomplish this? #pragma warning(default: all) This isn't valid as it is; I can give a specific warning number instead of all and that will restore that one warning to default, but I want to restore all warnings to their default. I don't want to write out a long list of all t...
Ben Hymers
1

votes
1

answer
894

Views

How can I exclude a file from g++ compiler options

I'd like to compile most of my code with -Wconversion -Werror. The problem is that I use a .cpp file that is open source and should not be modified, and compiling it with those flags fails because that specific .cpp file has issues with some 'implicit conversions that may alter a value'. Can I some...
Kam
1

votes
1

answer
48

Views

Can Visual Studio warning messages be selectively purged?

Is there any way I can purge certain warning messages in Visual Studio 2010 (or 2012 for that matter). In some instances VS complains that a given CSS property is not known, even though such properties are applicable for certain browsers.
QFDev
1

votes
3

answer
358

Views

How to configure Visual Studio not to output warnings from libraries?

Is there any way to prevent Visual Studio from printing out warnings from included libraries? \Wall gives me loads of warnings from STL and Qt headers, although I only want to see those originating from my own code (i.e. the code which is part of the current Visual Studio project).
user1101674
1

votes
1

answer
3.2k

Views

f951 error: unrecognized command line option

I am on linux and I am compiling the following: mpif90 -shared source.F90 object1.o object2.o -L/some/path -Qoption,link,-rpath=/some/path -I/some/path -lhdf5 -lhdf5_fortran -fPIC -fpp -DDECDEC_ -DMSMS_ -cxxlib-gcc -o libhdfwrapper.so and I get f95: unrecognized option '-Qoption,link,-rpath=/some/...
simona
1

votes
3

answer
2k

Views

How to get rid of the warning: Implicit conversion shortens 64-bit value into a 32-bit value

First of all, I am a beginner in c++ and I am using Xcode 4.6.2. The compiler configuration is default. I only switched the the compiler to gcc 4.2. If I compile my little code I get the following warnings: Implicit conversion shortens 64-bit value into a 32-bit value Implicit conversion loses inte...
Vertex
1

votes
2

answer
515

Views

How to suppress the warning “Assignment within conditional. Did you mean == instead of =?”

With the new ASC 2.0 compiler I get warnings when I code like below: // (_achievementsFromServer is an Array) while(item=_achievementsFromServer.pop()) { // do something with item here } The warning reads: 'Assignment within conditional. Did you mean == instead of =?' While in general I appreciate...
frankhermes
1

votes
1

answer
140

Views

What does “BS warning” mean?

In a recent mail, I saw a phrase 'BS warning'. Although this mail is in Emacs's mailing list, I don't think this phrase it's Emacs-specific. I've searched the web, but didn't get anything that looked relevant. Any ideas?
user159
1

votes
1

answer
737

Views

How to suppress the “dead store” compiler warning on Xcode?

How can I suppress the 'dead store' warning on a single file in Xcode? I tried #pragma clang diagnostic push #pragma clang diagnostic ignored '-Wunused-value' without luck. Any suggestions? BTW, I don't want to 'fix' the code, because I'm creating a bunch of objects only for the sake of inserting t...
cfischer
5

votes
0

answer
34

Views

make std::optional constructor emit implicit conversion warnings

I'm trying to rid my codebase of lossy implicit conversions, so I'm compiling with the -Wconversion flag under clang++. The following code is expected to output a warning, but does not. #include #include #include #include int main() { size_t x = std::numeric_limits::max(); std::cout
user6480075
1

votes
1

answer
965

Views

How to add a compiler warning in Android Studio?

In C# in Visual Studio I can do this with #warning The following method needs refactoring for clarity What's the Android Studio equivalent?
cja

View additional questions