Beispiel #1
0
void test_null_pointer()
{
  C_func(0, C_tag); // no-warning
  C_func((void *) 0, C_tag); // no-warning
  C_func((int *) 0, C_tag); // no-warning
  C_func((long *) 0, C_tag); // expected-warning {{argument type 'long *' doesn't match specified 'c' type tag that requires 'int *'}}
}
Beispiel #2
0
void test_tag_mismatch(int *ptr)
{
  A_func(ptr, &A_tag); // no-warning
  A_func(ptr, &B_tag); // expected-warning {{this type tag was not designed to be used with this function}}
  C_func(ptr, C_tag); // no-warning
  C_func(ptr, D_tag); // expected-warning {{this type tag was not designed to be used with this function}}
  C_func(ptr, 10); // no-warning
  C_func(ptr, 20); // should warn, but may cause false positives
}
Beispiel #3
0
void Task::AddIntoProcesser(Processer *proc, char* shared_stack, uint32_t shared_stack_cap)
{
    assert(!proc_);
    proc_ = proc;
    if (!ctx_.Init([this]{C_func(this);}, shared_stack, shared_stack_cap)) {
        state_ = TaskState::fatal;
        fprintf(stderr, "task(%s) init, getcontext error:%s\n",
                DebugInfo(), strerror(errno));
        return ;
    }

    state_ = TaskState::runnable;
}
Beispiel #4
0
static void
kuzn_expand_key(struct kuzn_ctx *ctx)
{
	int i, j;
	uint8_t *ptr;
	uint8_t C[16];

	ptr = ctx->keys + 32;

	for (i = 0; i < 4; i++) {
		memcpy(ptr, ptr - 32, 32);
		for (j = 0; j < 8; j++) {
			C_func(C, 8*i + j + 1, ctx);
			F_func(ptr, ptr, C, ctx);
		}
		ptr += 32;
	}
}
Beispiel #5
0
Task::Task(TaskF const& fn, std::size_t stack_size)
    : id_(++s_id), ctx_(stack_size, [this]{C_func(this);}), fn_(fn)
{
    ++s_task_count;
}