[PATCH U-BOOT 03/26] fs: btrfs: Cross-port btrfs_read_dev_super() from btrfs-progs
Qu Wenruo
quwenruo.btrfs at gmx.com
Wed Apr 22 10:34:43 CEST 2020
On 2020/4/22 下午4:26, Marek Behun wrote:
> On Wed, 22 Apr 2020 14:49:46 +0800
> Qu Wenruo <wqu at suse.com> wrote:
>
>> +/* A simple wraper to for error() from btrfs-progs */
>> +#define error(...) { printf(__VA_ARGS__); printf("\n"); }
>
> Is this from btrfs-progs?
Nope, anything in compat.h is mostly for different projects to share the
same code.
> I don't like these macros much, I prefer to use static inline functions.
>
> static inline void error(const char *fmt, ...)
> {
> printf(fmt, __builtin_va_arg_pack());
> printf("\n");
> }
That looks much better, especially we can tell compiler that we want
printf check on the parameters.
Thanks,
Qu
>
> Attribute for printf can be added to check printf specifiers:
> __attribute__((format (__printf__, 1, 2)))
>
> It is possible that this won't compile when optimizations are disabled.
> In that case more attributes are needed
> __always_inline __attribute__((__gnu_inline__))
> These could be defined as a macro in include/linux/compiler-gcc.h
> #define __gnu_inline __always_inline __attribute__((__gnu_inline__))
>
> Marek
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200422/c21dd025/attachment.sig>
More information about the U-Boot
mailing list