int main() { int b[10][10]; int (*c)[sizeof(int)*10]; if (foo6(10, b, c) != 10*sizeof(int)*sizeof(int)) return 1; return foo(10); }
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}} }
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); }
int main(int argc, char* argv[]) { foo(0); foobar(1); bar(); fourbar(); foo5(0); foo6(0); return 0; }
int main(int argc, char* argv[]) { switch(argc) { case 1: return foo1(); case 2: return foo2(); case 3: return foo3(); case 4: return foo4(); case 5: return foo5(); case 6: return foo6(); default: return -1; } }
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); }
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; }
S0 foo5(long double a0) { return foo6(1, 2, a0); }
int main() { return foo6(); }
int main() { printf("\nStack trace pgm "); foo6(); }
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"); }
void foo7(void) { foo6(); } /* { dg-bogus "warning:" "this function should not get any warnings" } */
int foo5 (int d5) { return foo6 (d5 + getpid ()); }