Contiki-NG
Macros
cc.h File Reference

Default definitions of C compiler quirk work-arounds. More...

#include "contiki.h"
#include "sys/cc-gcc.h"

Go to the source code of this file.

Macros

#define CC_REGISTER_ARG
 Configure if the C compiler supports the "register" keyword for function arguments.
 
#define CC_FUNCTION_POINTER_ARGS   0
 Configure if the C compiler supports the arguments for function pointers.
 
#define CC_CONST_FUNCTION   const
 Configure if the C compiler have problems with const function pointers.
 
#define CC_UNSIGNED_CHAR_BUGS   0
 Configure work-around for unsigned char bugs with sdcc.
 
#define CC_DOUBLE_HASH   0
 Configure if C compiler supports double hash marks in C macros.
 
#define CC_ASSIGN_AGGREGATE(dest, src)   *dest = *src
 Configure if the C compiler supports the assignment of struct value.
 
#define CC_ACCESS_NOW(type, variable)   (*(volatile type *)&(variable))
 This macro ensures that the access to a non-volatile variable can not be reordered or optimized by the compiler. More...
 
#define CC_CONCAT(s1, s2)   CC_CONCAT2(s1, s2)
 A C preprocessing macro for concatenating two preprocessor tokens. More...
 
#define CC_CONCAT3(s1, s2, s3)   s1##s2##s3
 A C preprocessing macro for concatenating three preprocessor tokens.
 

Detailed Description

Default definitions of C compiler quirk work-arounds.

Author
Adam Dunkels adam@.nosp@m.dunk.nosp@m.els.c.nosp@m.om

This file is used for making use of extra functionality of some C compilers used for Contiki, and defining work-arounds for various quirks and problems with some other C compilers.

Definition in file cc.h.

Macro Definition Documentation

◆ CC_ACCESS_NOW

#define CC_ACCESS_NOW (   type,
  variable 
)    (*(volatile type *)&(variable))

This macro ensures that the access to a non-volatile variable can not be reordered or optimized by the compiler.

See also https://lwn.net/Articles/508991/ - In Linux the macro is called ACCESS_ONCE The type must be passed, because the typeof-operator is a gcc extension

Definition at line 130 of file cc.h.

◆ CC_CONCAT

#define CC_CONCAT (   s1,
  s2 
)    CC_CONCAT2(s1, s2)

A C preprocessing macro for concatenating two preprocessor tokens.

We need use two macros (CC_CONCAT and CC_CONCAT2) in order to allow concatenation of two #defined macros.

Definition at line 156 of file cc.h.