============================================
|
|
Include directives
|
|
============================================
|
|
|
|
#include "some/path.h"
|
|
#include <stdint.h>
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(preproc_include (string_literal))
|
|
(preproc_include (system_lib_string)))
|
|
|
|
============================================
|
|
Object-like macro definitions
|
|
============================================
|
|
|
|
#define ONE
|
|
#define TWO int a = b;
|
|
#define THREE \
|
|
c == d ? \
|
|
e : \
|
|
f
|
|
#define FOUR mno
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(preproc_def (identifier))
|
|
(preproc_def (identifier) (preproc_arg))
|
|
(preproc_def (identifier) (preproc_arg))
|
|
(preproc_def (identifier) (preproc_arg)))
|
|
|
|
============================================
|
|
Function-like macro definitions
|
|
============================================
|
|
|
|
#define ONE() a
|
|
#define TWO(b) c
|
|
#define THREE(d, e) f
|
|
#define FOUR(...) g
|
|
#define FIVE(h, i, ...) j
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(preproc_function_def (identifier) (preproc_params) (preproc_arg))
|
|
(preproc_function_def (identifier) (preproc_params (identifier)) (preproc_arg))
|
|
(preproc_function_def (identifier) (preproc_params (identifier) (identifier)) (preproc_arg))
|
|
(preproc_function_def (identifier) (preproc_params) (preproc_arg))
|
|
(preproc_function_def (identifier) (preproc_params (identifier) (identifier)) (preproc_arg)))
|
|
|
|
============================================
|
|
Ifdefs
|
|
============================================
|
|
|
|
#ifndef DEFINE1
|
|
int j;
|
|
#endif
|
|
|
|
#ifdef DEFINE2
|
|
ssize_t b;
|
|
#define c 32
|
|
#else
|
|
int b;
|
|
#define c 16
|
|
#endif
|
|
|
|
#ifdef DEFINE2
|
|
#else
|
|
#ifdef DEFINE3
|
|
#else
|
|
#endif
|
|
#endif
|
|
|
|
---
|
|
|
|
(translation_unit
|
|
(preproc_ifdef
|
|
(identifier)
|
|
(declaration (identifier) (identifier)))
|
|
|
|
(preproc_ifdef
|
|
(identifier)
|
|
(declaration (identifier) (identifier))
|
|
(preproc_def (identifier) (preproc_arg))
|
|
(preproc_else
|
|
(declaration (identifier) (identifier))
|
|
(preproc_def (identifier) (preproc_arg))))
|
|
|
|
(preproc_ifdef
|
|
(identifier)
|
|
(preproc_else
|
|
(preproc_ifdef
|
|
(identifier)
|
|
(preproc_else)))))
|