git: acpica: Remove redundant checks to fix -Waddress warnings

Aaron LI aly at crater.dragonflybsd.org
Tue Oct 13 23:15:10 PDT 2026


commit 553dd9e976d1b3312b11f46bf40a71cddc63d8bd
Author: Aaron LI <aly at aaronly.me>
Date:   Wed Oct 14 13:36:12 2026 +0800

    acpica: Remove redundant checks to fix -Waddress warnings
    
    The 'Source' field defined as a flexible array in a struct, so the
    checks are always true.
    
    Obtained from FreeBSD (commit d19b0f3ea51bc68a1c095176a7c491370d433cc0).
    
    Fix the following '-Waddress' warnings given by GCC 12.5:
    
    ```
    /usr/src/sys/dev/acpica/acpi_pcib.c: In function 'prt_attach_devices':
    /usr/src/sys/dev/acpica/acpi_pcib.c:99:23: warning: the comparison will always evaluate as 'false' for the address of 'Source' will never be NULL [-Waddress]
       99 |     if (entry->Source == NULL || entry->Source[0] == '\0')
          |                       ^~
    In file included from /usr/src/sys/contrib/dev/acpica/source/include/platform/acenv.h:298,
                     from /usr/src/sys/contrib/dev/acpica/source/include/acpi.h:164,
                     from /usr/src/sys/dev/acpica/acpi_pcib.c:38:
    /usr/src/sys/contrib/dev/acpica/source/include/acrestyp.h:953:59: note: 'Source' declared here
      953 |                                     ACPI_FLEX_ARRAY(char, Source);
          |                                                           ^~~~~~
    /usr/src/sys/contrib/dev/acpica/source/include/platform/acgcc.h:223:22: note: in definition of macro 'ACPI_FLEX_ARRAY'
      223 |                 TYPE NAME[];                    \
          |                      ^~~~
    /usr/src/sys/dev/acpica/acpi_pcib.c: In function 'acpi_pcib_route_interrupt':
    /usr/src/sys/dev/acpica/acpi_pcib.c:239:25: warning: the comparison will always evaluate as 'true' for the address of 'Source' will never be NULL [-Waddress]
      239 |         if (prt->Source != NULL && prt->Source[0] != '\0')
          |                         ^~
    /usr/src/sys/contrib/dev/acpica/source/include/acrestyp.h:953:59: note: 'Source' declared here
      953 |                                     ACPI_FLEX_ARRAY(char, Source);
          |                                                           ^~~~~~
    /usr/src/sys/contrib/dev/acpica/source/include/platform/acgcc.h:223:22: note: in definition of macro 'ACPI_FLEX_ARRAY'
      223 |                 TYPE NAME[];                    \
          |                      ^~~~
    /usr/src/sys/dev/acpica/acpi_pcib.c:251:21: warning: the comparison will always evaluate as 'false' for the address of 'Source' will never be NULL [-Waddress]
      251 |     if (prt->Source == NULL || prt->Source[0] == '\0' ||
          |                     ^~
    /usr/src/sys/contrib/dev/acpica/source/include/acrestyp.h:953:59: note: 'Source' declared here
      953 |                                     ACPI_FLEX_ARRAY(char, Source);
          |                                                           ^~~~~~
    /usr/src/sys/contrib/dev/acpica/source/include/platform/acgcc.h:223:22: note: in definition of macro 'ACPI_FLEX_ARRAY'
      223 |                 TYPE NAME[];                    \
          |                      ^~~~
    ```

Summary of changes:
 sys/dev/acpica/acpi_pcib.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/553dd9e976d1b3312b11f46bf40a71cddc63d8bd


-- 
DragonFly BSD source repository


More information about the Commits mailing list