Wed May 1 07:43:42 2024 UTC (32d)
sys/cdefs.h: pass __aligned to lint

Lint could parse _Alignas and __attribute__((__aligned__(4))) previously
but simply ignored them. Since today, they affect the layout of struct
and union.


(rillig)
diff -r1.160 -r1.161 src/sys/sys/cdefs.h

cvs diff -r1.160 -r1.161 src/sys/sys/cdefs.h (expand / switch to unified diff)

--- src/sys/sys/cdefs.h 2023/04/30 08:45:48 1.160
+++ src/sys/sys/cdefs.h 2024/05/01 07:43:41 1.161
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cdefs.h,v 1.160 2023/04/30 08:45:48 riastradh Exp $ */ 1/* $NetBSD: cdefs.h,v 1.161 2024/05/01 07:43:41 rillig Exp $ */
2 2
3/* * Copyright (c) 1991, 1993 3/* * Copyright (c) 1991, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to Berkeley by 6 * This code is derived from software contributed to Berkeley by
7 * Berkeley Software Design, Inc. 7 * Berkeley Software Design, Inc.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -441,27 +441,27 @@ @@ -441,27 +441,27 @@
441 * For C99 compilers other than GCC, the C99 behavior is expected. 441 * For C99 compilers other than GCC, the C99 behavior is expected.
442 */ 442 */
443#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__) 443#if defined(__GNUC__) && defined(__GNUC_STDC_INLINE__)
444#define __c99inline extern __attribute__((__gnu_inline__)) __inline 444#define __c99inline extern __attribute__((__gnu_inline__)) __inline
445#elif defined(__GNUC__) 445#elif defined(__GNUC__)
446#define __c99inline extern __inline 446#define __c99inline extern __inline
447#elif defined(__STDC_VERSION__) || defined(__lint__) 447#elif defined(__STDC_VERSION__) || defined(__lint__)
448#define __c99inline __inline 448#define __c99inline __inline
449#endif 449#endif
450 450
451#if defined(__lint__) 451#if defined(__lint__)
452#define __thread /* delete */ 452#define __thread /* delete */
453#define __packed __packed 453#define __packed __packed
454#define __aligned(x) /* delete */ 454#define __aligned(x) _Alignas((x))
455#define __section(x) /* delete */ 455#define __section(x) /* delete */
456#elif __GNUC_PREREQ__(2, 7) || defined(__PCC__) || defined(__lint__) 456#elif __GNUC_PREREQ__(2, 7) || defined(__PCC__) || defined(__lint__)
457#define __packed __attribute__((__packed__)) 457#define __packed __attribute__((__packed__))
458#define __aligned(x) __attribute__((__aligned__(x))) 458#define __aligned(x) __attribute__((__aligned__(x)))
459#define __section(x) __attribute__((__section__(x))) 459#define __section(x) __attribute__((__section__(x)))
460#elif defined(_MSC_VER) 460#elif defined(_MSC_VER)
461#define __packed /* ignore */ 461#define __packed /* ignore */
462#else 462#else
463#define __packed error: no __packed for this compiler 463#define __packed error: no __packed for this compiler
464#define __aligned(x) error: no __aligned for this compiler 464#define __aligned(x) error: no __aligned for this compiler
465#define __section(x) error: no __section for this compiler 465#define __section(x) error: no __section for this compiler
466#endif 466#endif
467 467