#!/bin/sh
# postprocessor of C preprocessor - removes __attribute__ declarations, which are not compatible for pycparser

CPP=${1}
shift 1

${CPP} "${@}" | sed \
    -e 's/ __asm(.*);$/;/' \
    -e 's/__attribute__ ((visibility("default"))) //' \
    -e 's/__attribute__((unused))//' \
    -e 's/__attribute__((aligned(8)));/;/' \
    -e 's/__attribute__((availability(.*)));/;/' \
    -e 's/__attribute__((availability(.*)))//' \
    -e 's/__attribute__((format.*)));$/;/' \
    -e 's/__inline__/inline/' \
    -e 's/__THROW;$/;/' \
    -e 's/__END_DECLS//' \
    -e 's/__BEGIN_DECLS//' \
    -e 's/void (\*signal(int, void (\*)(int)))(int);//'
