Atmel CAVR-4 Manuale Utente

Pagina di 323
CAVR-4
Part 2. Compiler reference
Pragma directives
219
#pragma diag_warning
#pragma diag_warning=tag,tag,...
Changes the severity level to 
warning
 for the specified diagnostics. For example:
#pragma diag_warning=Pe826
See the chapter Diagnostics for more information about diagnostic messages.
#pragma include_alias
#pragma include_alias "orig_header" "subst_header"
#pragma include_alias <orig_header> <subst_header>
The 
#pragma
 
include_alias
 directive makes it possible to provide an alias for a 
header file. This is useful for substituting one header file with another, and for 
specifying an absolute path to a relative file.
The parameter 
subst_header
 is used for specifying an alias for 
orig_header
. This 
pragma directive must appear before the corresponding 
#include
 directives and 
subst_header
 must match its corresponding 
#include
 directive exactly.
Example
#pragma include_alias <stdio.h> <C:\MyHeaders\stdio.h>
#include <stdio.h>
This example will substitute the relative file 
stdio.h
 with a counterpart located 
according to the specified path.
#pragma inline
#pragma inline[=forced]
The 
#pragma
 
inline
 directive advises the compiler that the function whose 
declaration follows immediately after the directive should be inlined—that is, expanded 
into the body of the calling function. Whether the inlining actually takes place is subject 
to the compiler’s heuristics.
This is similar to the C++ keyword 
inline
, but has the advantage of being available in 
C code.
Specifying 
#pragma inline=forced
 disables the compiler’s heuristics and forces the 
inlining. If the inlining fails for some reason, for example if it cannot be used with the 
function type in question (like 
printf
), an error message is emitted.