From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 2/5] lib: Add LTP_ATTRIBUTE_FALLTHROUGH for case statements
Date: Tue, 21 Aug 2018 14:08:09 +0200 [thread overview]
Message-ID: <20180821120809.GC20217@dell5510> (raw)
In-Reply-To: <20180820064257.17974-3-rpalethorpe@suse.com>
Hi Richard,
> Can be used in place of break if you deliberately want to fallthrough to the
> next case statement.
...
> +++ b/include/tst_common.h
> @@ -24,6 +24,7 @@
> #define LTP_ATTRIBUTE_NORETURN __attribute__((noreturn))
> #define LTP_ATTRIBUTE_UNUSED __attribute__((unused))
> #define LTP_ATTRIBUTE_UNUSED_RESULT __attribute__((warn_unused_result))
> +#define LTP_ATTRIBUTE_FALLTHROUGH __attribute__((fallthrough))
This does not work on old GCC versions, it was added in GCC 7
* GCC < 7
fcntl33.c: In function ‘do_test’:
fcntl33.c:160:3: warning: empty declaration
LTP_ATTRIBUTE_FALLTHROUGH;
IMHO the most portable way is to use comment /* Fall through */, but maybe we
don't care much about.
Kind regards,
Petr
next prev parent reply other threads:[~2018-08-21 12:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 6:42 [LTP] [PATCH 0/5] Convert tst_timer.h to newlib Richard Palethorpe
2018-08-20 6:42 ` [LTP] [PATCH 1/5] Convert nanosleep02 " Richard Palethorpe
2018-08-20 6:42 ` [LTP] [PATCH 2/5] lib: Add LTP_ATTRIBUTE_FALLTHROUGH for case statements Richard Palethorpe
2018-08-21 12:08 ` Petr Vorel [this message]
2018-08-30 15:46 ` Cyril Hrubis
2018-08-20 6:42 ` [LTP] [PATCH 3/5] Convert fcntl33 to newlib Richard Palethorpe
2018-08-20 6:42 ` [LTP] [PATCH 4/5] Convert futex_wait_bitset tests " Richard Palethorpe
2018-08-20 6:42 ` [LTP] [PATCH 5/5] tst_timer: Convert to new library Richard Palethorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180821120809.GC20217@dell5510 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox