Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compilation warnings when using LTO #5

Merged
merged 1 commit into from
Jan 26, 2025
Merged

Fix compilation warnings when using LTO #5

merged 1 commit into from
Jan 26, 2025

Conversation

mathieucarbou
Copy link
Member

Rename structures to avoid compilation warning when using LTO compilation flags:

build_flags             =  -flto=auto
build_unflags           =  -fno-lto

Warnings are caused by a conflict with structure names in AsyncUDP:

/Users/mat/.platformio/packages/framework-arduinoespressif32-src-77c8e93767360b28deee4aedf5d0a1ab/libraries/AsyncUDP/src/AsyncUDP.cpp:161:3: warning: type 'struct lwip_event_packet_t' violates the C++ One Definition Rule [-Wodr]
  161 | } lwip_event_packet_t;
      |   ^
.pio/libdeps/oss-esp32/AsyncTCP/src/AsyncTCP.cpp:121:3: note: a different type is defined in another translation unit
  121 | } lwip_event_packet_t;
      |   ^
/Users/mat/.platformio/packages/framework-arduinoespressif32-src-77c8e93767360b28deee4aedf5d0a1ab/libraries/AsyncUDP/src/AsyncUDP.cpp:155:9: note: the first difference of corresponding definitions is field 'arg'
  155 |   void *arg;
      |         ^
.pio/libdeps/oss-esp32/AsyncTCP/src/AsyncTCP.cpp:87:18: note: a field with different name is defined in another translation unit
   87 |     lwip_event_t event;
      |                  ^

See discussion in pioarduino Discord: https://discord.com/channels/1263397951829708871/1263397951829708874/1332807939395686472

Rename structures to avoid compilation warning when using LTO compilation flags:

```
build_flags             =  -flto=auto
build_unflags           =  -fno-lto
```

Warnings are caused by a conflict with structure names in AsyncUDP:

```
/Users/mat/.platformio/packages/framework-arduinoespressif32-src-77c8e93767360b28deee4aedf5d0a1ab/libraries/AsyncUDP/src/AsyncUDP.cpp:161:3: warning: type 'struct lwip_event_packet_t' violates the C++ One Definition Rule [-Wodr]
  161 | } lwip_event_packet_t;
      |   ^
.pio/libdeps/oss-esp32/AsyncTCP/src/AsyncTCP.cpp:121:3: note: a different type is defined in another translation unit
  121 | } lwip_event_packet_t;
      |   ^
/Users/mat/.platformio/packages/framework-arduinoespressif32-src-77c8e93767360b28deee4aedf5d0a1ab/libraries/AsyncUDP/src/AsyncUDP.cpp:155:9: note: the first difference of corresponding definitions is field 'arg'
  155 |   void *arg;
      |         ^
.pio/libdeps/oss-esp32/AsyncTCP/src/AsyncTCP.cpp:87:18: note: a field with different name is defined in another translation unit
   87 |     lwip_event_t event;
      |                  ^
```
@mathieucarbou mathieucarbou self-assigned this Jan 25, 2025
Copy link

@vortigont vortigont left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Also seen those warnings, better have it renamed this way.

@mathieucarbou mathieucarbou merged commit 4cfb603 into main Jan 26, 2025
22 checks passed
@mathieucarbou mathieucarbou deleted the lto branch January 26, 2025 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants