Issue created by Saahil Shaw: 
https://gitlab.rtems.org/rtems/pkg/rtems-net-legacy/-/work_items/30



## Summary

When building \`rtems-net-legacy\` on RTEMS 7 for the \`sparc/erc32\` BSP, 
compilation fails in \`testsuites/support/net-legacy-config.c\` due to a 
function signature mismatch between core RTEMS and \`rtems-net-legacy\`.

## Error

```
[217/218] Compiling testsuites/support/net-legacy-config.c
../../testsuites/support/net-legacy-config.c:34:3: error: initialization of 
'int (*)(struct rtems_bsdnet_ifconfig *, int)' from incompatible pointer type 
'int (*)(struct rtems_bsdnet_ifconfig *)' [-Wincompatible-pointer-types]
   34 |   RTEMS_BSP_NETWORK_DRIVER_ATTACH
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../testsuites/support/net-legacy-config.c:34:3: note: (near initialization 
for 'ifcfg.attach')
In file included from ../../testsuites/support/net-legacy-config.c:16:
/home/saahil/development/rtems/7/sparc-rtems7/erc32/lib/include/bsp.h:63:12: 
note: 'rtems_erc32_sonic_driver_attach' declared here


   63 | extern int rtems_erc32_sonic_driver_attach(
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Waf: Leaving directory 
`/home/saahil/development/rtems/rtems-net-legacy/build/sparc-rtems7-erc32'
Build failed
 -> task in 'testsupport' failed with exit status 1 (run with -v to display 
more information)
```

## Cause

#### 1) **_erc32/lib/include/bsp.h_ -**   

```
extern int rtems_erc32_sonic_driver_attach( struct rtems_bsdnet_ifconfig 
*config );
```

Takes only 1 arguement.

#### 2) **_include/rtems/rtems_bsdnet.h -_** 

```
/*
 * This function now handles attaching and detaching an interface.
 * The parameter attaching indicates the operation being invoked.
 * For older attach functions which do not have the extra parameter
 * it will be ignored.
 */
int (*attach)(struct rtems_bsdnet_ifconfig *conf, int attaching);
```

The attach field of struct is defined to take 2 arguments.

While older C compilers permitted this assignment implicitly, GCC 14+ in RTEMS 
7 treats `-Wincompatible-pointer-types` as a hard error.

### Environment

* RTEMS 7 (main) 
* BSP: sparch/erc32

### Possible solutions:

1) Explicitly cast `RTEMS_BSP_NETWORK_DRIVER_ATTACH` in `net-legacy-config.c` 
to `(int (*)(struct rtems_bsdnet_ifconfig *, int))` as intended by the header 
comment.

2) Update the `erc32` BSP driver attach declaration/definition in core RTEMS to 
accept the 2nd `int attaching` parameter.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/pkg/rtems-net-legacy/-/work_items/30
You're receiving this email because of your account on gitlab.rtems.org. 
Unsubscribe from this thread: 
https://gitlab.rtems.org/-/namespace/21/sent_notifications/6-352daagxeyljmgj20tf06said-l/unsubscribe
 | Manage all notifications: https://gitlab.rtems.org/-/profile/notifications | 
Help: https://gitlab.rtems.org/help


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to