Re: [PATCH 1/2] tracing: Remove "__attribute__()" from the type field of event format

kernel test robot
2025-07-09T01:06:49Z

[-- Attachment #1: Type: text/plain, Size: 4208 bytes --]

Hi Masami,

kernel test robot noticed the following build errors:

[auto build test ERROR on trace/for-next]
[also build test ERROR on linus/master v6.16-rc5 next-20250708]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu-Google/tracing-Remove-__attribute__-from-the-type-field-of-event-format/20250708-195600
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/175197568917.977073.2201559708302320631.stgit%40mhiramat.tok.corp.google.com
patch subject: [PATCH 1/2] tracing: Remove "__attribute__()" from the type field of event format
:::::: branch date: 13 hours ago
:::::: commit date: 13 hours ago
config: arc-randconfig-001-20250709 (attached as .config)
compiler: arc-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (attached as reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202507090856.swUa0d8T-lkp@intel.com/

All errors (new ones prefixed by >>):

kernel/trace/trace_events.c: In function 'sanitize_field_type':
>> kernel/trace/trace_events.c:120:30: error: initializer element is not constant
static const int attr_len = strlen(ATTRIBUTE_STR);
^~~~~~

vim +120 kernel/trace/trace_events.c

c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 116)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 117) /* Remove all __attribute__() from type */
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 118) static void sanitize_field_type(char *type)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 119) {
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 @120) static const int attr_len = strlen(ATTRIBUTE_STR);
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 121) char *attr, *tmp, *next;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 122) int depth;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 123)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 124) next = type;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 125) while ((attr = strstr(next, ATTRIBUTE_STR))) {
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 126) next = attr + attr_len;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 127)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 128) /* Retry if __attribute__ is a part of type name. */
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 129) if ((attr != type && !isspace(attr[-1])) ||
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 130) attr[attr_len] != '(')
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 131) continue;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 132)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 133) depth = 0;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 134) while ((tmp = strpbrk(next, "()"))) {
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 135) if (*tmp == '(')
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 136) depth++;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 137) else
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 138) depth--;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 139) next = tmp + 1;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 140) if (depth == 0)
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 141) break;
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 142) }
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 143) next = skip_spaces(next);
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 144) strcpy(attr, next);
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 145) }
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 146) }
c4415fcf8cbdb4 Masami Hiramatsu (Google 2025-07-08 147)

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 36116 bytes --]

[-- Attachment #3: reproduce --]
[-- Type: text/plain, Size: 778 bytes --]

reproduce (this is a W=1 build):
git clone https://github.com/intel/lkp-tests.git ~/lkp-tests
git remote add trace https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
git fetch trace for-next
git checkout trace/for-next
b4 shazam https://lore.kernel.org/r/175197568917.977073.2201559708302320631.stgit@mhiramat.tok.corp.google.com
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-8.5.0 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=arc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-8.5.0 ~/lkp-tests/kbuild/make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/iio/imu/inv_icm42600/ fs/ kernel/trace/