I'm using IAR ARM 7.10 and getting a warning:
Warning[25]: Label 'Reset_Handler' is defined pubweak in a section implicitly declared root...
It is cause the system reset sometimes.
How do I resolve this warning?
Yes, straight from iAR Support page:
Problem
After upgrading to EWARM 7.10.1 the Warning[25] is issued during assembly of a file that assembled without warning on earlier version of EWARM.
Background
The assembler (iasmarm) is (from EWARM 7.10.1) issuing Warning[25] for a deprecated assembler construction.
The deprecated assembler source construction looks like this:
PUBWEAK NMI_Handler
SECTION .text:CODE:REORDER(1)
NMI_Handler
Solution
To avoid the warning, add ":NOROOT" to the "SECTION" statement:
PUBWEAK NMI_Handler
SECTION .text:CODE:REORDER:NOROOT(1)
NMI_Handler
In "startup_*.s" file replace string
SECTION .text:CODE:REORDER(1)
with string
SECTION .text:CODE:NOROOT:REORDER(1)
just before every symbol wich cause the warning.
Related
I installed a clangd plugin in VSCode to develop C++.
This plugin works well, but it shows some code error/waring in our project because we use a deprecated function in <zstd.h>.
include <zstd.h>
deprecated function
How can I mask this error without changing the code?
For example, I can ignore some warning in the VSCode's cpplint plugin by modifying .vscode/settings.json:
ignore some error on cpplint plugin
Can I do something like that to the VSCode's clangd plugin? thanks~
I try to use clang diagnostic, but it seems not work.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-attributes"
#include <zstd.h>
#pragma clang diagnostic pop
clang diagnostic don't work
First, note that the reason for the error is not the function being deprecated, it's a parsing error ("an attribute list cannot appear here"). The note related to deprecation is just a comment that shows up in the hover, unrelated to the error diagnostic.
If you'd like to suppress the error, you can do it using https://clangd.llvm.org/config.html#suppress. For example, you could create a .clangd file in your project root containing:
Diagnostics:
Suppress: attributes_not_allowed
(Note, attributes_not_allowed is the diagnostic code of the error from the first screenshot.)
However, suppressing the diagnostic is likely to just paper over an underlying problem that's likely related to your project's configuration. A better approach would be to fix the underlying issue. To do that, please review the project setup instructions and ensure your project has a compile_commands.json and clangd is finding it; if that doesn't resolve the issue, feel free to post clangd logs for further diagnosis.
I am attempting to compile a C++ library for a Tegra TK1. The library links to TBB, which I pulled using the package manager. During compilation I got the following error
/tmp/cc4iLbKz.s: Assembler messages:
/tmp/cc4iLbKz.s:9541: Error: thumb conditional instruction should be in IT block -- `strexeq r2,r3,[r4]'
A bit of googling and this question led me to try adding -mimplicit-it=thumb to CMAKE_CXX_FLAGS, but the compiler doesn't recognize it.
I am compiling on the tegra with kernal 3.10.40-grinch-21.3.4, and using gcc 4.8.4 compiler (thats what comes back when I type c++ -v)
I'm not sure what the initial error message means, though I think it has something to do with the TBB linked library rather than the source I'm compiling. The problem with the fix is also mysterious. Can anyone shed some light on this?
-mimplicit-it is an option to the assembler, not to the compiler. Thus, in the absence of specific assembler flags in your makefile (which you probably don't have, given that you don't appear to be using a separate assembler step), you'll need to use the -Wa option to the compiler to pass it through, i.e. -Wa,-mimplicit-it=thumb.
The source of the issue is almost certainly some inline assembly - possibly from a static inline in a header file if you're really only linking pre-built libraries - which contains conditionally-executed instructions (I'm going to guess its something like a cmpxchg implementation). Since your toolchain could well be configured to compile to the Thumb instruction set - which requires a preceding it (If-Then) instruction to set up conditional instructions - by default, another alternative might be to just compile with -marm (and/or remove -mthumb if appropriate) and sidestep the issue by not using Thumb at all.
Adding compiler option:
-wa
should solve the problem.
I’m building a Cocos2d-x game for Android on a Mac, using Android NDK, and I get many warnings like this when compiling the C++ part:
/usr/include/module.map:1662:22: warning: unknown attribute 'extern_c' [-Wignored-attributes]
Is it dangerous? How can I fix it?
I'm guessing that extern_c is a compiler directive for the module map saying it is referencing functions from C++ that were written in the C language (different call frame structure).
The LLVM portion of the CLANG compiler is probably having a version mismatch.
http://clang.llvm.org/docs/Modules.html#module-maps
Try a command line $ clang -v
You may have to verify the compiler library version
xcode->preferences->locations->command line tools.
Ultimately you will want to clear this up so your stack frames match the arguments and your not referencing a C language function.
We're doing some code cleanup, fixing signed/unsigned comparisons, running static analysis, etc, on the code base of C, C++, and Java.
One of the warnings we're getting is
warning: ISO C does not permit named variadic macros
And its companion warning
warning: ISO C99 requires rest arguments to be used
Now, in the C code I used the C99 standard variadic macro to fix the problem, but in the C++ code, what is the correct answer? Using the same C99 style results in a different warning
warning: anonymous variadic macros were introduced in C99
For which I don't see any answers.
We're using GCC (G++) 4.4.3 in Linux.
I'm hoping there is some flag, or other method that can correct, or disable it for the specific section of code - but its for the logging which is used in almost every file...
Use the gcc option -Wno-variadic-macros to disable that particular warning.
Edit: (from comments)
To disable the warning for a section of code but leave it on in general, use #pragma GCC diagnostic described here.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wvariadic-macros"
// Your code and/or include files
// (No variadic warnings here)
#pragma GCC diagnostic pop
Is there a way to inspect object file generated from code below ( file1.o ) for presence of compiler introduced temporary? What tools can we use to obtain such info from object files?
//file1.cpp
void func(const int& num){}
int main(){ func(2); }
The easiest way I can think of to do this is to load up a program that uses the object file and disassemble the function in the debugger. The program code you posted would work fine for this. Just break on the call to func and then display the assembler when you single-step into the function.
In a more complex program you can usually display the assembler code for a given function by name. Check your debugger documentation for how to do this. On Windows (Visual Studio) you can open the Disassembly window and enter the name of the function to display the assembler code.
If you have the source, most compilers allow you to output assembler, sometimes mixed with the source code. For Visual C++ this is /Fa.
If you're on an ELF system and have GNU binutils you can call readelf, probably with the -s switch.
If you have the source available, it is probably easier to look at the assembler file generated by the compiler (-save-temps for gcc). Otherwise, objdump is your friend.
You can use clang -cc1 --ast-print-xml to get a XML representation of a translation unit. The presence of temporaries can be easily detected from the AST.