int main ()
{

  foo1(1, NULL); // OK
  foo1(1, 0) ; // expected-warning {{missing sentinel in function call}}
  foo5(1, NULL, 2);  // OK
  foo5(1,2,NULL, 1); // OK
  foo5(1, NULL, 2, 1); // expected-warning {{missing sentinel in function call}}

  foo6(1,2,3,4,5,6,7); // expected-warning {{missing sentinel in function call}}
  foo6(1,NULL,3,4,5,6,7); // OK
  foo7(1); // expected-warning {{not enough variable arguments in 'foo7' declaration to fit a sentinel}}
  foo7(1, NULL); // OK

  foo12(1); // expected-warning {{not enough variable arguments in 'foo12' declaration to fit a sentinel}}
}
示例#2
0
void test1() {
    foo1(1, NULL); // OK
    foo1(1, 0) ; // expected-warning {{missing sentinel in function call}}
    foo5(1, NULL, 2);  // OK
    foo5(1,2,NULL, 1); // OK
    foo5(1, NULL, 2, 1); // expected-warning {{missing sentinel in function call}}

    foo6(1,2,3,4,5,6,7); // expected-warning {{missing sentinel in function call}}
    foo6(1,NULL,3,4,5,6,7); // OK
    foo7(1); // expected-warning {{not enough variable arguments in 'foo7' declaration to fit a sentinel}}
    foo7(1, NULL); // OK

    foo12(1); // expected-warning {{not enough variable arguments in 'foo12' declaration to fit a sentinel}}

    // PR 5685
    struct A {};
    struct A a, b, c;
    foo1(3, &a, &b, &c); // expected-warning {{missing sentinel in function call}}
    foo1(3, &a, &b, &c, (struct A*) 0);
}
示例#3
0
int main(int argc, char **argv) {
  void *ptr = (void *)&foo7;
  g(foo8);

  (void)ptr;
#ifndef __x86_64__
  // expected-error@+2 {{interrupt service routine cannot be called directly}}
#endif
  foo7((int *)argv, argc);
  foo8((int *)argv);       // expected-error {{interrupt service routine cannot be called directly}}
  return 0;
}
示例#4
0
int main ()
{
  if (foo1 (0x13) != 8)
    abort();

  if (foo2 (0x06) != 27)
    abort();

  if (foo3 (0x02) != 4)
    abort();

  if (foo4 (0x01) != 7)
    abort();

  if (foo5 (0x15) != 65)
    abort();

  if (foo6 (0x103) != 8)
    abort();

  if (foo7 (0x04) != 21)
    abort();

  if (foo8 (0x07) != 72)
    abort();

  if (foo9 (0x10000011L) != 0)
    abort();

  if (foo10 (0x1000105L) != 0)
    abort();

  if (foo11 (0x1000008L) != 39)
    abort();

  if (foo12 (0x1000004L) != 0)
    abort();

  if (foo13 (0x109LL) != 0)
    abort();

  if (foo14 (0x108LL) != 39)
    abort();

  if (foo15 (0x1000001LL) != 7)
    abort();

  if (foo16 (0x100000004LL) != 21)
    abort();

  return 0;
}
示例#5
0
int main(int argc, char **argv) {
  void *ptr = (void *)&foo7;
  g(foo8);
  (void)ptr;
  a::foo(ptr); // expected-error {{interrupt service routine cannot be called directly}}
  bar1(foo);
#ifndef __x86_64__
  // expected-error@+2 {{interrupt service routine cannot be called directly}}
#endif
  foo7((int *)argv, argc);
  foo8((int *)argv);       // expected-error {{interrupt service routine cannot be called directly}}
  bar(argv); // expected-note {{in instantiation of function template specialization 'bar<char *>' requested here}}
  return 0;
}
示例#6
0
extern void bar(void)
{
  foo1 (); /* { dg-error "not enough|too few arguments" "sentinel" } */
  foo1 (NULL); /* { dg-warning "not enough" "sentinel" } */
  foo1 ("a"); /* { dg-warning "not enough" "sentinel" } */
  foo1 ("a", 1); /* { dg-warning "missing sentinel" "sentinel" } */
  foo1 ("a", 0); /* { dg-warning "missing sentinel" "sentinel" } */
  foo1 ("a", (void*)1); /* { dg-warning "missing sentinel" "sentinel" } */
  foo1 ("a", NULL, 1); /* { dg-warning "missing sentinel" "sentinel" } */
  foo1 ("a", NULL);

  foo5 (NULL); /* { dg-warning "not enough" "sentinel" } */
  foo5 (NULL, 1); /* { dg-warning "not enough" "sentinel" } */
  foo5 ("a", NULL); /* { dg-warning "not enough" "sentinel" } */
  foo5 ("a", NULL, 1);
  foo5 ("a", 1, 2, 3, NULL); /* { dg-warning "missing sentinel" "sentinel" } */
  foo5 ("a", 1, 2, NULL, 3);
  foo5 ("a", 1, NULL, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */
  foo5 ("a", NULL, 1, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */
  foo5 ("a", 0, 1, 2, 3); /* { dg-warning "missing sentinel" "sentinel" } */

  foo6 ("a", 1, NULL); /* { dg-warning "not enough" "sentinel" } */
  foo6 ("a", 1, NULL, 2); /* { dg-warning "not enough" "sentinel" } */
  foo6 ("a", 1, NULL, 2, 3); /* { dg-warning "not enough" "sentinel" } */
  foo6 ("a", NULL, 1, 2, 3); /* { dg-warning "not enough" "sentinel" } */
  foo6 ("a", NULL, 1, 2, 3, 4); /* { dg-warning "not enough" "sentinel" } */
  foo6 (NULL, 1, 2, 3, 4, 5); /* { dg-warning "not enough" "sentinel" } */
  foo6 ("a", NULL, 1, 2, 3, 4, 5);
  foo6 ("a", 0, NULL, 1, 2, 3, 4, 5);
  foo6 ("a", 0, 1, 2, 3, 4, 5); /* { dg-warning "missing sentinel" "sentinel" } */
  foo6 ("a", NULL, 1, 2, 3, 4, 5, 6); /* { dg-warning "missing sentinel" "sentinel" } */

  foo7 ("a", 1, 2, 3, NULL);

  execl ("/bin/ls", "/bin/ls", "-aFC"); /* { dg-warning "missing sentinel" "sentinel" } */
  execl ("/bin/ls", "/bin/ls", "-aFC", 0); /* { dg-warning "missing sentinel" "sentinel" } */
  execl ("/bin/ls", "/bin/ls", "-aFC", NULL);

  execlp ("ls", "ls", "-aFC"); /* { dg-warning "missing sentinel" "sentinel" } */
  execlp ("ls", "ls", "-aFC", 0); /* { dg-warning "missing sentinel" "sentinel" } */
  execlp ("ls", "ls", "-aFC", NULL);

  execle ("ls", "ls", "-aFC", ".", envp); /* { dg-warning "missing sentinel" "sentinel" } */
  execle ("ls", "ls", "-aFC", ".", 0, envp); /* { dg-warning "missing sentinel" "sentinel" } */
  execle ("ls", "ls", "-aFC", ".", NULL, envp);
}
示例#7
0
void testLua(lua_State* L) {
	printf("------------testLua------------\n");
	ELuna::LuaFunction<void> foo0(L, "foo0");
	ELuna::LuaFunction<void> foo1(L, "foo1");
	ELuna::LuaFunction<void> foo2(L, "foo2");
	ELuna::LuaFunction<void> foo3(L, "foo3");
	ELuna::LuaFunction<void> foo4(L, "foo4");
	ELuna::LuaFunction<void> foo5(L, "foo5");
	ELuna::LuaFunction<void> foo6(L, "foo6");
	ELuna::LuaFunction<void> foo7(L, "foo7");
	ELuna::LuaFunction<void> foo8(L, "foo8");
	ELuna::LuaFunction<void> foo9(L, "foo9");

	ELuna::LuaFunction<int> retFoo0(L, "retFoo0");
	ELuna::LuaFunction<int> retFoo1(L, "retFoo1");
	ELuna::LuaFunction<int> retFoo2(L, "retFoo2");
	ELuna::LuaFunction<int> retFoo3(L, "retFoo3");
	ELuna::LuaFunction<int> retFoo4(L, "retFoo4");
	ELuna::LuaFunction<int> retFoo5(L, "retFoo5");
	ELuna::LuaFunction<int> retFoo6(L, "retFoo6");
	ELuna::LuaFunction<int> retFoo7(L, "retFoo7");
	ELuna::LuaFunction<int> retFoo8(L, "retFoo8");
	ELuna::LuaFunction<int> retFoo9(L, "retFoo9");
	ELuna::LuaFunction<TestObj*> luaTestObjPointer(L, "luaTestObjPointer");
	ELuna::LuaFunction<TestObj&> luaTestObjRef(L, "luaTestObjRef");
	ELuna::LuaFunction<TestObj> luaTestObj(L, "luaTestObj");

	foo0();
	foo1(1);
	foo2(1,2);
	foo3(1,2,3);
	foo4(1,2,3,4);
	foo5(1,2,3,4,5);
	foo6(1,2,3,4,5,6);
	foo7(1,2,3,4,5,6,7);
	foo8(1,2,3,4,5,6,7,8);
	foo9(1,2,3,4,5,6,7,8,9);

	printf("retFoo0: %d\n", retFoo0());
	printf("retFoo1: %d\n", retFoo1(1));
	printf("retFoo2: %d\n", retFoo2(1,2));
	printf("retFoo3: %d\n", retFoo3(1,2,3));
	printf("retFoo4: %d\n", retFoo4(1,2,3,4));
	printf("retFoo5: %d\n", retFoo5(1,2,3,4,5));
	printf("retFoo6: %d\n", retFoo6(1,2,3,4,5,6));
	printf("retFoo7: %d\n", retFoo7(1,2,3,4,5,6,7));
	printf("retFoo8: %d\n", retFoo8(1,2,3,4,5,6,7,8));
	printf("retFoo9: %d\n", retFoo9(1,2,3,4,5,6,7,8,9));

	printf("luaTestObjPointer: \n");
	TestObj pObj = TestObj("TestObjPointer");
	TestObj* retPObj = luaTestObjPointer(&pObj);
	pObj.print();
	retPObj->print();

	printf("luaTestObjRef1: \n");
	TestObj objRef1("TestObjRef1");
	TestObj& retObjRef1 = luaTestObjRef(&objRef1);
	objRef1.print();
	retObjRef1.print();
	
	printf("luaTestObjRef2: \n");
	TestObj objRef2("TestObjRef2");
	TestObj& retObjRef2 = luaTestObjRef(objRef2);
	objRef2.print();
	retObjRef2.print();
	
	printf("luaTestObj: \n");
	TestObj obj("TestObj");
	TestObj retObj = luaTestObj(obj);
	obj.print();
	retObj.print();
	printf("pass refrence to luaFunction the same as object!\n");
}
示例#8
0
void
foo8(void)
{
  foo7();
} /* { dg-warning "'noreturn' function does return" "detect return from tail call" } */
示例#9
0
文件: switch.c 项目: 4ntoine/clang
// CHECK-LABEL: define void @foo7()
// CHECK-NOT: switch
// CHECK: }
void foo7(){
    switch(0){
      foo7();
    }
}
示例#10
0
int foo6 (int d6)
{
  return foo7 (d6 + getpid ());
}