linux/tools/testing/selftests/bpf/progs/btf_dump_test_case_namespacing.c
<<
>>
Prefs
   1// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause)
   2
   3/*
   4 * BTF-to-C dumper test validating no name versioning happens between
   5 * independent C namespaces (struct/union/enum vs typedef/enum values).
   6 *
   7 * Copyright (c) 2019 Facebook
   8 */
   9/* ----- START-EXPECTED-OUTPUT ----- */
  10struct S {
  11        int S;
  12        int U;
  13};
  14
  15typedef struct S S;
  16
  17union U {
  18        int S;
  19        int U;
  20};
  21
  22typedef union U U;
  23
  24enum E {
  25        V = 0,
  26};
  27
  28typedef enum E E;
  29
  30struct A {};
  31
  32union B {};
  33
  34enum C {
  35        A = 1,
  36        B = 2,
  37        C = 3,
  38};
  39
  40struct X {};
  41
  42union Y {};
  43
  44enum Z;
  45
  46typedef int X;
  47
  48typedef int Y;
  49
  50typedef int Z;
  51
  52/*------ END-EXPECTED-OUTPUT ------ */
  53
  54int f(struct {
  55        struct S _1;
  56        S _2;
  57        union U _3;
  58        U _4;
  59        enum E _5;
  60        E _6;
  61        struct A a;
  62        union B b;
  63        enum C c;
  64        struct X x;
  65        union Y y;
  66        enum Z *z;
  67        X xx;
  68        Y yy;
  69        Z zz;
  70} *_)
  71{
  72        return 0;
  73}
  74