# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MPLAB XC16 C-Compiler

- 1
- 2
…
- 178
- 179
- 180
- 181
- 182
…
- 365
- 366

MPLAB
®
XC16 C Compiler Users Guide
DS50002071C-page 180  2012-2013 Microchip Technology Inc.
__attribute__ ((format_arg (2)));
This causes the compiler to check the arguments in calls to my_dgettext, whose
result is passed to a printf, scanf or strftime type function for consistency with
the printf style format string argument my_format.
The parameter string-index specifies which argument is the format string
argument (starting from 1).
The format-arg attribute allows you to identify your own functions which modify
format strings, so that the compiler can check the calls to printf, scanf or
strftime function, whose operands are a call to one of your own functions.
interrupt [ ( [ save(list) ] [, irq(irqid) ]
[, altirq(altirqid)] [, preprologue(asm) ] ) ]
Use this option to indicate that the specified function is an interrupt handler. The compiler
will generate function prologue and epilogue sequences suitable for use in an interrupt
handler when this attribute is present. The optional parameter save specifies a list of
variables to be saved and restored in the function prologue and epilogue, respectively.
The optional parameters irq and altirq specify interrupt vector table IDs to be used.
The optional parameter preprologue specifies assembly code that is to be emitted
before the compiler-generated prologue code. See Chapter 14. Interrupts for a full
description, including examples.
When using the interrupt attribute, please specify either auto_psv or no_au-
to_psv. If none is specified a warning will be produced and auto_psv will be assumed.
keep
The keep attribute will prevent the linker from removing the function with the ELF linker
option --gc-sections, even if it is unused.
void __attribute__((keep)) func();
naked
The naked attribute will prevent the compiler from saving or restoring any registers.
This attribute should be applied with caution as failing to save or restore registers may
cause issues. Consider using this attribute with noreturn for safety - any attempt to
return will cause a reset.
void __attribute__((naked)) func();
near
The near attribute tells the compiler that the function can be called using a more
efficient form of the call instruction.
no_instrument_function
If the command line option -finstrument-function is given, profiling function calls
will be generated at entry and exit of most user-compiled functions. Functions with this
attribute will not be so instrumented.
noload
The noload attribute indicates that space should be allocated for the function, but that
the actual code should not be loaded into memory. This attribute could be useful if an
application is designed to load a function into memory at run time, such as from a serial
EEPROM.
void bar() __attribute__ ((noload)) {
...
}

- 1
- 2
…
- 178
- 179
- 180
- 181
- 182
…
- 365
- 366