14 lines · c
1// RUN: %clang_cc1 -x c -triple bpf-pc-linux-gnu -dwarf-version=4 -fsyntax-only -verify %s2 3struct {4 char f1[100];5 int f2;6} tmp = {};7 8unsigned invalid1(void) { return __builtin_btf_type_id(1, tmp); } // expected-error {{__builtin_btf_type_id argument 2 not a constant}}9unsigned invalid2(void) { return __builtin_btf_type_id(1, 1, 1); } // expected-error {{too many arguments to function call, expected 2, have 3}}10 11int valid1(void) { return __builtin_btf_type_id(tmp, 0); }12int valid2(void) { return __builtin_btf_type_id(&tmp, 1); }13int valid3(void) { return __builtin_btf_type_id(tmp.f1[4], 10); }14