Re: [PATCH 1/1] Macros with multiple statements should be enclosed in a do - while loop.

From: kernel test robot
Date: Wed Feb 10 2021 - 21:45:57 EST


Hi Fatih,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]
[also build test ERROR on v5.11-rc7 next-20210125]
[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]

url: https://github.com/0day-ci/linux/commits/Fatih-YILDIRIM/Coding-style-fix/20210211-061613
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 6953026f21092199a59f2c641a880b1c4025f932
config: powerpc-randconfig-r026-20210209 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/0day-ci/linux/commit/68ce21dfbba245eaa3442ad1269237e99aae5d50
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Fatih-YILDIRIM/Coding-style-fix/20210211-061613
git checkout 68ce21dfbba245eaa3442ad1269237e99aae5d50
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/staging/greybus/loopback.c:273:1: error: expected identifier or '('
gb_loopback_stats_attrs(latency);
^
drivers/staging/greybus/loopback.c:166:2: note: expanded from macro 'gb_loopback_stats_attrs'
do { \
^
>> drivers/staging/greybus/loopback.c:273:1: error: expected identifier or '('
drivers/staging/greybus/loopback.c:170:4: note: expanded from macro 'gb_loopback_stats_attrs'
} while (0)
^
drivers/staging/greybus/loopback.c:275:1: error: expected identifier or '('
gb_loopback_stats_attrs(requests_per_second);
^
drivers/staging/greybus/loopback.c:166:2: note: expanded from macro 'gb_loopback_stats_attrs'
do { \
^
drivers/staging/greybus/loopback.c:275:1: error: expected identifier or '('
drivers/staging/greybus/loopback.c:170:4: note: expanded from macro 'gb_loopback_stats_attrs'
} while (0)
^
drivers/staging/greybus/loopback.c:277:1: error: expected identifier or '('
gb_loopback_stats_attrs(throughput);
^
drivers/staging/greybus/loopback.c:166:2: note: expanded from macro 'gb_loopback_stats_attrs'
do { \
^
drivers/staging/greybus/loopback.c:277:1: error: expected identifier or '('
drivers/staging/greybus/loopback.c:170:4: note: expanded from macro 'gb_loopback_stats_attrs'
} while (0)
^
drivers/staging/greybus/loopback.c:279:1: error: expected identifier or '('
gb_loopback_stats_attrs(apbridge_unipro_latency);
^
drivers/staging/greybus/loopback.c:166:2: note: expanded from macro 'gb_loopback_stats_attrs'
do { \
^
drivers/staging/greybus/loopback.c:279:1: error: expected identifier or '('
drivers/staging/greybus/loopback.c:170:4: note: expanded from macro 'gb_loopback_stats_attrs'
} while (0)
^
drivers/staging/greybus/loopback.c:281:1: error: expected identifier or '('
gb_loopback_stats_attrs(gbphy_firmware_latency);
^
drivers/staging/greybus/loopback.c:166:2: note: expanded from macro 'gb_loopback_stats_attrs'
do { \
^
drivers/staging/greybus/loopback.c:281:1: error: expected identifier or '('
drivers/staging/greybus/loopback.c:170:4: note: expanded from macro 'gb_loopback_stats_attrs'
} while (0)
^
>> drivers/staging/greybus/loopback.c:319:3: error: use of undeclared identifier 'dev_attr_latency_min'; did you mean 'dev_attr_timeout_min'?
&dev_attr_latency_min.attr,
^~~~~~~~~~~~~~~~~~~~
dev_attr_timeout_min
drivers/staging/greybus/loopback.c:290:1: note: 'dev_attr_timeout_min' declared here
gb_loopback_ro_attr(timeout_min);
^
drivers/staging/greybus/loopback.c:130:8: note: expanded from macro 'gb_loopback_ro_attr'
static DEVICE_ATTR_RO(field)
^
include/linux/device.h:135:26: note: expanded from macro 'DEVICE_ATTR_RO'
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
^
<scratch space>:46:1: note: expanded from here
dev_attr_timeout_min
^
>> drivers/staging/greybus/loopback.c:320:3: error: use of undeclared identifier 'dev_attr_latency_max'; did you mean 'dev_attr_timeout_max'?
&dev_attr_latency_max.attr,
^~~~~~~~~~~~~~~~~~~~
dev_attr_timeout_max
drivers/staging/greybus/loopback.c:292:1: note: 'dev_attr_timeout_max' declared here
gb_loopback_ro_attr(timeout_max);
^
drivers/staging/greybus/loopback.c:130:8: note: expanded from macro 'gb_loopback_ro_attr'
static DEVICE_ATTR_RO(field)
^
include/linux/device.h:135:26: note: expanded from macro 'DEVICE_ATTR_RO'
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
^
<scratch space>:50:1: note: expanded from here
dev_attr_timeout_max
^
>> drivers/staging/greybus/loopback.c:321:3: error: use of undeclared identifier 'dev_attr_latency_avg'
&dev_attr_latency_avg.attr,
^
>> drivers/staging/greybus/loopback.c:322:3: error: use of undeclared identifier 'dev_attr_requests_per_second_min'
&dev_attr_requests_per_second_min.attr,
^
>> drivers/staging/greybus/loopback.c:323:3: error: use of undeclared identifier 'dev_attr_requests_per_second_max'
&dev_attr_requests_per_second_max.attr,
^
>> drivers/staging/greybus/loopback.c:324:3: error: use of undeclared identifier 'dev_attr_requests_per_second_avg'
&dev_attr_requests_per_second_avg.attr,
^
>> drivers/staging/greybus/loopback.c:325:3: error: use of undeclared identifier 'dev_attr_throughput_min'; did you mean 'dev_attr_timeout_min'?
&dev_attr_throughput_min.attr,
^~~~~~~~~~~~~~~~~~~~~~~
dev_attr_timeout_min
drivers/staging/greybus/loopback.c:290:1: note: 'dev_attr_timeout_min' declared here
gb_loopback_ro_attr(timeout_min);
^
drivers/staging/greybus/loopback.c:130:8: note: expanded from macro 'gb_loopback_ro_attr'
static DEVICE_ATTR_RO(field)
^
include/linux/device.h:135:26: note: expanded from macro 'DEVICE_ATTR_RO'
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
^
<scratch space>:46:1: note: expanded from here
dev_attr_timeout_min
^
>> drivers/staging/greybus/loopback.c:326:3: error: use of undeclared identifier 'dev_attr_throughput_max'; did you mean 'dev_attr_timeout_max'?
&dev_attr_throughput_max.attr,
^~~~~~~~~~~~~~~~~~~~~~~
dev_attr_timeout_max
drivers/staging/greybus/loopback.c:292:1: note: 'dev_attr_timeout_max' declared here
gb_loopback_ro_attr(timeout_max);
^
drivers/staging/greybus/loopback.c:130:8: note: expanded from macro 'gb_loopback_ro_attr'
static DEVICE_ATTR_RO(field)
^
include/linux/device.h:135:26: note: expanded from macro 'DEVICE_ATTR_RO'
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
^
<scratch space>:50:1: note: expanded from here
dev_attr_timeout_max
^
>> drivers/staging/greybus/loopback.c:327:3: error: use of undeclared identifier 'dev_attr_throughput_avg'
&dev_attr_throughput_avg.attr,
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.


vim +273 drivers/staging/greybus/loopback.c

355a7058153e04 Alexandre Bailon 2015-03-31 271
355a7058153e04 Alexandre Bailon 2015-03-31 272 /* Time to send and receive one message */
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @273 gb_loopback_stats_attrs(latency);
583cbf50e0a4c8 Bryan O'Donoghue 2015-07-21 274 /* Number of requests sent per second on this cport */
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 275 gb_loopback_stats_attrs(requests_per_second);
355a7058153e04 Alexandre Bailon 2015-03-31 276 /* Quantity of data sent and received on this cport */
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 277 gb_loopback_stats_attrs(throughput);
1ec5843ee98899 Bryan O'Donoghue 2015-10-15 278 /* Latency across the UniPro link from APBridge's perspective */
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 279 gb_loopback_stats_attrs(apbridge_unipro_latency);
1ec5843ee98899 Bryan O'Donoghue 2015-10-15 280 /* Firmware induced overhead in the GPBridge */
e54b106dd1be50 Sandeep Patil 2016-05-19 281 gb_loopback_stats_attrs(gbphy_firmware_latency);
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 282
e140c75ed9f689 Bryan O'Donoghue 2015-07-21 283 /* Number of errors encountered during loop */
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 284 gb_loopback_ro_attr(error);
12927835d21127 Bryan O'Donoghue 2015-12-07 285 /* Number of requests successfully completed async */
12927835d21127 Bryan O'Donoghue 2015-12-07 286 gb_loopback_ro_attr(requests_completed);
12927835d21127 Bryan O'Donoghue 2015-12-07 287 /* Number of requests timed out async */
12927835d21127 Bryan O'Donoghue 2015-12-07 288 gb_loopback_ro_attr(requests_timedout);
12927835d21127 Bryan O'Donoghue 2015-12-07 289 /* Timeout minimum in useconds */
12927835d21127 Bryan O'Donoghue 2015-12-07 290 gb_loopback_ro_attr(timeout_min);
12927835d21127 Bryan O'Donoghue 2015-12-07 291 /* Timeout minimum in useconds */
12927835d21127 Bryan O'Donoghue 2015-12-07 292 gb_loopback_ro_attr(timeout_max);
355a7058153e04 Alexandre Bailon 2015-03-31 293
355a7058153e04 Alexandre Bailon 2015-03-31 294 /*
799a3f03572afa Bryan O'Donoghue 2015-07-21 295 * Type of loopback message to send based on protocol type definitions
355a7058153e04 Alexandre Bailon 2015-03-31 296 * 0 => Don't send message
799a3f03572afa Bryan O'Donoghue 2015-07-21 297 * 2 => Send ping message continuously (message without payload)
006335a02677ed Alex Elder 2015-08-03 298 * 3 => Send transfer message continuously (message with payload,
799a3f03572afa Bryan O'Donoghue 2015-07-21 299 * payload returned in response)
799a3f03572afa Bryan O'Donoghue 2015-07-21 300 * 4 => Send a sink message (message with payload, no payload in response)
355a7058153e04 Alexandre Bailon 2015-03-31 301 */
67d1eeceb1aab4 Bryan O'Donoghue 2015-08-17 302 gb_dev_loopback_rw_attr(type, d);
355a7058153e04 Alexandre Bailon 2015-03-31 303 /* Size of transfer message payload: 0-4096 bytes */
67d1eeceb1aab4 Bryan O'Donoghue 2015-08-17 304 gb_dev_loopback_rw_attr(size, u);
48f19ee8244776 Alex Elder 2015-05-11 305 /* Time to wait between two messages: 0-1000 ms */
b36f04fa9417c5 Bryan O'Donoghue 2015-12-07 306 gb_dev_loopback_rw_attr(us_wait, d);
00af6583d15038 Bryan O'Donoghue 2015-07-21 307 /* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
67d1eeceb1aab4 Bryan O'Donoghue 2015-08-17 308 gb_dev_loopback_rw_attr(iteration_max, u);
67d1eeceb1aab4 Bryan O'Donoghue 2015-08-17 309 /* The current index of the for (i = 0; i < iteration_max; i++) loop */
f06272b283e159 Bryan O'Donoghue 2015-08-17 310 gb_dev_loopback_ro_attr(iteration_count, false);
12927835d21127 Bryan O'Donoghue 2015-12-07 311 /* A flag to indicate synchronous or asynchronous operations */
12927835d21127 Bryan O'Donoghue 2015-12-07 312 gb_dev_loopback_rw_attr(async, u);
12927835d21127 Bryan O'Donoghue 2015-12-07 313 /* Timeout of an individual asynchronous request */
12927835d21127 Bryan O'Donoghue 2015-12-07 314 gb_dev_loopback_rw_attr(timeout, u);
8e3fba55d379bb Bryan O'Donoghue 2015-12-11 315 /* Maximum number of in-flight operations before back-off */
8e3fba55d379bb Bryan O'Donoghue 2015-12-11 316 gb_dev_loopback_rw_attr(outstanding_operations_max, u);
355a7058153e04 Alexandre Bailon 2015-03-31 317
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 318 static struct attribute *loopback_attrs[] = {
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @319 &dev_attr_latency_min.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @320 &dev_attr_latency_max.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @321 &dev_attr_latency_avg.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @322 &dev_attr_requests_per_second_min.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @323 &dev_attr_requests_per_second_max.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @324 &dev_attr_requests_per_second_avg.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @325 &dev_attr_throughput_min.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @326 &dev_attr_throughput_max.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 @327 &dev_attr_throughput_avg.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 328 &dev_attr_apbridge_unipro_latency_min.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 329 &dev_attr_apbridge_unipro_latency_max.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 330 &dev_attr_apbridge_unipro_latency_avg.attr,
e54b106dd1be50 Sandeep Patil 2016-05-19 331 &dev_attr_gbphy_firmware_latency_min.attr,
e54b106dd1be50 Sandeep Patil 2016-05-19 332 &dev_attr_gbphy_firmware_latency_max.attr,
e54b106dd1be50 Sandeep Patil 2016-05-19 333 &dev_attr_gbphy_firmware_latency_avg.attr,
355a7058153e04 Alexandre Bailon 2015-03-31 334 &dev_attr_type.attr,
355a7058153e04 Alexandre Bailon 2015-03-31 335 &dev_attr_size.attr,
b36f04fa9417c5 Bryan O'Donoghue 2015-12-07 336 &dev_attr_us_wait.attr,
00af6583d15038 Bryan O'Donoghue 2015-07-21 337 &dev_attr_iteration_count.attr,
00af6583d15038 Bryan O'Donoghue 2015-07-21 338 &dev_attr_iteration_max.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 339 &dev_attr_async.attr,
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 340 &dev_attr_error.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 341 &dev_attr_requests_completed.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 342 &dev_attr_requests_timedout.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 343 &dev_attr_timeout.attr,
8e3fba55d379bb Bryan O'Donoghue 2015-12-11 344 &dev_attr_outstanding_operations_max.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 345 &dev_attr_timeout_min.attr,
12927835d21127 Bryan O'Donoghue 2015-12-07 346 &dev_attr_timeout_max.attr,
f06272b283e159 Bryan O'Donoghue 2015-08-17 347 NULL,
f06272b283e159 Bryan O'Donoghue 2015-08-17 348 };
8e1d6c336d7497 Bryan O'Donoghue 2015-12-03 349 ATTRIBUTE_GROUPS(loopback);
355a7058153e04 Alexandre Bailon 2015-03-31 350

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip