compiler-warnings

f951 error: unrecognized command line option

Deadly 提交于 2021-02-19 07:10:47
问题 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/path' f95: unrecognized option '-cxxlib-gcc' f951: error: unrecognized command line option "-fpp" can anybody tell me why fpp is not recognized? 回答1: -fpp is a flag used by some compilers, notably

Is there a GCC warning for using symbols from the C library not through namespace std?

非 Y 不嫁゛ 提交于 2021-02-08 12:22:20
问题 Consider the following (buggy) C++ code: #include <cmath> #include <cstdlib> #include <iostream> int main() { if (abs(-0.75) != 0.75) { std::cout << "Math is broken!\n"; return 1; } else { return 0; } } This code is buggy because it calls abs (meaning ::abs ) instead of std::abs . Depending on the implementation, ::abs might not exist, or it might be the C abs , or it might be an overload set including a version for double , like std::abs is. With Clang on Linux, at least in my environment,

Is there a GCC warning for using symbols from the C library not through namespace std?

[亡魂溺海] 提交于 2021-02-08 12:22:06
问题 Consider the following (buggy) C++ code: #include <cmath> #include <cstdlib> #include <iostream> int main() { if (abs(-0.75) != 0.75) { std::cout << "Math is broken!\n"; return 1; } else { return 0; } } This code is buggy because it calls abs (meaning ::abs ) instead of std::abs . Depending on the implementation, ::abs might not exist, or it might be the C abs , or it might be an overload set including a version for double , like std::abs is. With Clang on Linux, at least in my environment,

Can I make Visual Studio warn me when I forget to assign String.Replace()?

橙三吉。 提交于 2021-02-08 09:02:46
问题 I just wrote the following line of C# code, and then spent a couple of minutes troubleshooting when the program didn't work as expected: myString.Replace(oldValue, newValue); ( myString , oldValue , and newValue are all string variables.) Obviously my intent was to cause the myString variable to be reassigned a new string equal to the original myString value but with the oldValue substring replaced by newValue . Equally obviously (in hindsight), that line of code didn't work because I should

No warning for implicit cast of bool to floating type?

泪湿孤枕 提交于 2021-02-07 13:18:28
问题 Looks like this snippet compiles in clang without warning, even with -Weverything: double x; ... if (fabs(x > 1.0)) { ... } Am I missing something? Or do the compiler and C++ standard think that casting bool to double is something that makes sense? 回答1: This is a consequence of making bool an integral type. According to C++ standard, section 3.9.1.6 Values of type bool are either true or false (Note: There are no signed , unsigned , short , or long bool types or values. — end note) Values of

Gitlab-CI: conditional allow_failure

a 夏天 提交于 2021-02-07 10:20:41
问题 I recently started implementing automatic tests for my code, and I noticed that the CI does not catch the warnings of the compiler - the tests are shown as successful even when there are warnings. I have initially added a flag for the compiler to turn the warnings into errors and allow_failure=True , but the problem is that the compiler stops in the first warning->error and does not go through the entire compilation. I then used the trick explained here to write the warnings into a file, and

Gitlab-CI: conditional allow_failure

那年仲夏 提交于 2021-02-07 10:20:01
问题 I recently started implementing automatic tests for my code, and I noticed that the CI does not catch the warnings of the compiler - the tests are shown as successful even when there are warnings. I have initially added a flag for the compiler to turn the warnings into errors and allow_failure=True , but the problem is that the compiler stops in the first warning->error and does not go through the entire compilation. I then used the trick explained here to write the warnings into a file, and

Disabling a specific compiler warning in VS Code

浪尽此生 提交于 2021-02-07 04:55:16
问题 I want to know how to suppress a specific compiler warning within VS Code for the entire project. I have seen this queston: Is it possible to disable specific compiler warnings? but it is for Visual studio, not Visual Studio Code. Here are the answers that where recommended in the question linked above: 1. Solution Explorer > View > Properties > Build > Suppress Warnings and 2. #pragma warning disable warning-list For #1: I can't find the Solution Explorer anywhere within VS Code. For #2 This

What does this mean (C++): “warning: pointer to a function used in arithmetic [Wpointer-arith]”?

喜你入骨 提交于 2021-02-05 08:10:36
问题 I am making a C++ program and I have a warning that keeps cropping up (I'm using g++): warning: pointer to a function used in arithmetic [Wpointer-arith] and I want to know: what exactly does this warning message mean? What is my compiler trying to tell me the problem is (in general terms) so I can better understand what I'm doing wrong? Google searches turn up specific solutions to specific problems in people's code, but never tell me exactly what this warning message is trying to say. I'm

How to comment out chunk of code in multi-line macro?

泄露秘密 提交于 2021-01-29 05:37:39
问题 I have a complex multi line macro code in C++ (that process some geometry and computes its physical properties in RT) which is used many times and can not be converted to function (without huge space and performance hits). The problem is I sometimes need to configure the code inside disabling parts of code (in compile time for specific tasks/machines) something like this: #define some_macro \ bla; \ bla; \ if (0) \ { \ bla; \ bla; \ bla; \ } \ bla; As you can see this leads to multiples of