# include/compiler/gcc.h File Reference

Compiler abstraction layer: GCC specifics. More...

`#include <arch/compiler-gcc.h>`

Include dependency graph for gcc.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | __noreturn __attribute__((noreturn))
| The function does not return.
#define | __must_check __attribute__((warn_unused_result))
| The return value must be checked.
#define | __packed __attribute__((packed))
| Pack structure contents.
#define | __section(name) __attribute__((section(name)))
| Place a function or data object in a specific section.
#define | __weak __attribute__((weak))
| Mark a function or data object as weak.
#define | __used __attribute__((used))
| Mark a function or data object as being used.
#define | __always_inline inline __attribute__((always_inline))
| The function should always be inlined.
#define | __printf_format(fmt_index, first_arg_index) __attribute__((format(printf, fmt_index, first_arg_index)))
| The function takes a printf-like format string.
#define | likely(exp) __builtin_expect(!!(exp), 1)
| The expression exp is likely to be true.
#define | unlikely(exp) __builtin_expect(!!(exp), 0)
| The expression exp is unlikely to be true.
#define | is_constant(exp) __builtin_constant_p(exp)
| Determine if an expression evaluates to a constant value.
#define | barrier() asm volatile("" ::: "memory")
| Optimization barrier.
#define | count_leading_zeroes(x) __builtin_clz(x)
| Count Leading Zeroes.
#define | min(x, y)
| Get the lowest of two values.
#define | max(x, y)
| Get the highest of two values.

## Detailed Description

Compiler abstraction layer: GCC specifics.

- Compiler: GNU GCC for AVR32
- Supported devices: All devices
- AppNote:

Author:
  Atmel Corporation: http://www.atmel.com
  Support and FAQ: http://support.atmel.no/

Definition in file gcc.h.

## Define Documentation

#define __always_inline inline __attribute__((always_inline))

The function should always be inlined.

This annotation instructs the compiler to ignore its inlining heuristics and inline the function no matter how big it thinks it becomes.

Definition at line 100 of file gcc.h.

#define __must_check __attribute__((warn_unused_result))

The return value must be checked.

This annotation may cause the compiler to warn if someone calls the annotated function without checking its return value.

Definition at line 58 of file gcc.h.

#define __noreturn __attribute__((noreturn))

The function does not return.

This function annotation gives a hint to the compiler that the function being annotated does not return. This may give the compiler some more room for optimizations.

Definition at line 51 of file gcc.h.

struct usb_endpoint_descriptor __packed __attribute__((packed))

Pack structure contents.

A Command Status Wrapper (CSW).

This annotation causes the compiler to omit any padding from a struct normally inserted to keep its fields aligned for maximum efficiency.

Standard USB device descriptor.

Standard USB device qualifier descriptor. This contains information about the device when running at the "other" speed (i.e. if the device is currently operating at high speed, this descriptor can be used to determine what would change if the device was operating at full speed.)

Standard USB configuration descriptor.

Standard USB interface descriptor.

Standard USB endpoint descriptor.

Definition at line 66 of file gcc.h.

#define __printf_format | ( | fmt_index,
|  | first_arg_index |  | ) | __attribute__((format(printf, fmt_index, first_arg_index)))

The function takes a printf-like format string.

This annotation may cause the compiler to emit a warning if the format string doesn't match the parameters given.

Definition at line 107 of file gcc.h.

#define __section | ( | name |  | ) | __attribute__((section(name)))

Place a function or data object in a specific section.

This annotation instructs the compiler to place the annotated function or data object in the section named name.

Definition at line 73 of file gcc.h.

#define __used __attribute__((used))

Mark a function or data object as being used.

The compiler will normally warn about functions or variables defined as static but not referenced anywhere. By annotating them with __used, the compiler will shut up and emit the symbol. This is useful when a symbol is only referenced by inline assembly code, for example.

Definition at line 92 of file gcc.h.

#define __weak __attribute__((weak))

Mark a function or data object as weak.

This annotation instructs the compiler to emit a weak symbol for the annotated function or data object. This allows other compilation units to override this definition by providing a strong symbol.

Definition at line 82 of file gcc.h.

#define barrier | ( |  | ) | asm volatile("" ::: "memory")

Optimization barrier.

This macro forces the compiler to reload any variables from memory. Local variables are left alone, unless they had their address taken at some point.

Definition at line 135 of file gcc.h.

Referenced by cpu_irq_restore(), ring_extract_entries(), ring_insert_entries(), softirq_disable(), udc_ep0_submit_in_req(), udc_ep0_submit_out_req(), udc_ep0_write_sync(), usbb_udc_submit_in_queue(), and usbb_udc_submit_out_queue().

#define count_leading_zeroes | ( | x |  | ) | __builtin_clz(x)

Count Leading Zeroes.

Count the number of 0 bits in x before the first 1 bit, starting at the most significant bit.

Definition at line 143 of file gcc.h.

Referenced by __ffs(), __fls(), and ilog2().

#define is_constant | ( | exp |  | ) | __builtin_constant_p(exp)

Determine if an expression evaluates to a constant value.

Parameters:

  | exp | Any expression

Returns:
  true if exp is constant, false otherwise.

Definition at line 126 of file gcc.h.

Referenced by gpio_get_value(), gpio_set_value(), ilog2(), pm_priv_osc_startup(), portmux_enable_spi(), portmux_enable_usart(), and serial_console_init().

#define likely | ( | exp |  | ) | __builtin_expect(!!(exp), 1)

The expression exp is likely to be true.

Definition at line 113 of file gcc.h.

Referenced by block_alloc_request().

#define max | ( | x,
|  | y |  | ) |

Value:

    ({                                      \
                    typeof(x) __x = (x);            \
                    typeof(y) __y = (y);            \
                    __x > __y ? __x : __y;          \
            })

Get the highest of two values.

Parameters:

  | x | An integer
  | y | Another integer

Returns:
  The numerically highest value of x and y.

Definition at line 164 of file gcc.h.

#define min | ( | x,
|  | y |  | ) |

Value:

    ({                                      \
                    typeof(x) __x = (x);            \
                    typeof(y) __y = (y);            \
                    __x < __y ? __x : __y;          \
            })

Get the lowest of two values.

Parameters:

  | x | An integer
  | y | Another integer

Returns:
  The numerically lowest value of x and y.

Definition at line 151 of file gcc.h.

Referenced by console_drv_write(), sdmmc_mcihost_init(), udc_ep0_write_sync(), and usb_func_get_descriptor().

#define unlikely | ( | exp |  | ) | __builtin_expect(!!(exp), 0)

The expression exp is unlikely to be true.

Definition at line 117 of file gcc.h.

Referenced by aes_duplicate_buffer_refs(), aesblk_alloc_req(), msc_do_read(), msc_submit_read_buffers(), msc_submit_write_data_req(), and usbb_udc_dma_interrupt().