You can suppress specific compiler errors and warnings by using #pragma diag_suppress in the header of your project before any include happens.
#pragma diag_suppress sets a specific warning code or multiple warning codes and the compiler will ignore those warnings.
All the error and warning codes can be found on http://infocenter.arm.com website.
Examples:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mbed.h" | |
// Tutorial at https://ee-programming-notepad.blogspot.com/2016/10/suppress-any-warning-in-mbed-compiler.html | |
// Readme: https://developer.arm.com/docs/dui0472/latest/compiler-specific-features/pragma-diag_suppress-tagtag | |
// Warning and error codes: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0496b/BABDJCCI.html | |
// Suppress "Warning: Integer conversion resulted in truncation in "main.cpp", Line: 15, Col: 16" | |
// 69 - Integer conversion resulted in truncation | |
#pragma diag_suppress 69 | |
uint16_t address; | |
int main() { | |
address = 0x10000; // unattainable address | |
} |
alternative link
References: developer.mbed.org/forum/, about diag_suppress tag, ARM compiler warning and error codes,
No comments:
Post a Comment