C-sparse

 view release on metacpan or  search on metacpan

src/sparse-0.4.4/README.md  view on Meta::CPAN

Linux's sparse fork with additional functionality:

* perl binding
* move globals to struct
* retain macro expansion trace
* dependency tree from tokens to declarations

It can be used for 

* Refactoring
* Macro dependency analysis
* C to hdl conversion

src/sparse-0.4.4/perl/t/include/disas/bfd.h  view on Meta::CPAN



/* Just print the address in hex.  This is included for completeness even
   though both GDB and objdump provide their own (to print symbolic
   addresses).  */
void generic_print_address(bfd_vma, struct disassemble_info *);

/* Always true.  */
int generic_symbol_at_address(bfd_vma, struct disassemble_info *);

/* Macro to initialize a disassemble_info struct.  This should be called
   by all applications creating such a struct.  */
#define INIT_DISASSEMBLE_INFO(INFO, STREAM, FPRINTF_FUNC) \
  (INFO).flavour = bfd_target_unknown_flavour, \
  (INFO).arch = bfd_arch_unknown, \
  (INFO).mach = 0, \
  (INFO).endian = BFD_ENDIAN_UNKNOWN, \
  INIT_DISASSEMBLE_INFO_NO_ARCH(INFO, STREAM, FPRINTF_FUNC)

/* Call this macro to initialize only the internal variables for the
   disassembler.  Architecture dependent things such as byte order, or machine

src/sparse-0.4.4/perl/t/target-arm/cpu.h  view on Meta::CPAN

     * "unwritable" bits or has write-one-to-clear or similar behaviour.
     */
    CPWriteFn *raw_writefn;
    /* Function for resetting the register. If NULL, then reset will be done
     * by writing resetvalue to the field specified in fieldoffset. If
     * fieldoffset is 0 then no reset will be done.
     */
    CPResetFn *resetfn;
};

/* Macros which are lvalues for the field in CPUARMState for the
 * ARMCPRegInfo *ri.
 */
#define CPREG_FIELD32(env, ri) \
    (*(uint32_t *)((char *)(env) + (ri)->fieldoffset))
#define CPREG_FIELD64(env, ri) \
    (*(uint64_t *)((char *)(env) + (ri)->fieldoffset))

#define REGINFO_SENTINEL { .type = ARM_CP_SENTINEL }

void define_arm_cp_regs_with_opaque(ARMCPU *cpu,

src/sparse-0.4.4/perl/t/tcg/tci/tcg-target.c  view on Meta::CPAN

#define TODO() \
    do { \
        fprintf(stderr, "TODO %s:%u: %s()\n", \
                __FILE__, __LINE__, __func__); \
        tcg_abort(); \
    } while (0)

/* Bitfield n...m (in 32 bit value). */
#define BITS(n, m) (((0xffffffffU << (31 - n)) >> (31 - n + m)) << m)

/* Macros used in tcg_target_op_defs. */
#define R       "r"
#define RI      "ri"
#if TCG_TARGET_REG_BITS == 32
# define R64    "r", "r"
#else
# define R64    "r"
#endif
#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
# define L      "L", "L"
# define S      "S", "S"

src/sparse-0.4.4/validation/builtin_safe1.c  view on Meta::CPAN

#define MY_MACRO(a) do { \
  __builtin_warning(!__builtin_safe_p(a), "Macro argument with side effects: " #a); \
    a;	\
  } while (0)

int g(int);
int h(int) __attribute__((pure));
int i(int) __attribute__((const));

static int foo(int x, int y)
{
  /* unsafe: */

src/sparse-0.4.4/validation/builtin_safe1.c  view on Meta::CPAN

  /* safe: */
  MY_MACRO(x+1);
  MY_MACRO(h(x));
  MY_MACRO(i(x));
  return x;
}

/*
 * check-name: __builtin_safe
 * check-error-start
builtin_safe1.c:13:3: warning: Macro argument with side effects: x++
builtin_safe1.c:14:3: warning: Macro argument with side effects: x+=1
builtin_safe1.c:15:3: warning: Macro argument with side effects: x=x+1
builtin_safe1.c:16:3: warning: Macro argument with side effects: x%=y
builtin_safe1.c:17:3: warning: Macro argument with side effects: x=y
builtin_safe1.c:18:3: warning: Macro argument with side effects: g(x)
builtin_safe1.c:19:3: warning: Macro argument with side effects: (y,g(x))
 * check-error-end
 */



( run in 0.579 second using v1.01-cache-2.11-cpan-49f99fa48dc )