Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

C++ Bindings, Compile-Warnungen auf PI, g++ 4.6.3

Featured Replies

Geschrieben

Hallo TF-Team,

 

bei den neuen C++ Bindings bekomme ich eine neue Compiler-Warnung auf dem Raspi, die bei meinen Settings zum Compile-Abbruch führt (-O2 -Wall -Werror):

ip_connection.c:49:3: error: ‘gcc_struct’ attribute directive ignored [-Werror=attributes]
ip_connection.c:60:3: error: ‘gcc_struct’ attribute directive ignored [-Werror=attributes]

 

Das stammt von diesem Code

#elif defined __GNUC__
        #define ATTRIBUTE_PACKED __attribute__((gcc_struct, packed))

 

Im Header dazu ist eine ähnliche Stelle, dort wird aber nur packed verwendet und nicht gcc_struct,packed. Die packed Option sollte überall gleichartig definiert sein - oder nicht?

(Interessanterweise führt das bei OpenSuse mit der identischen Compiler-Version nicht zu einer Warnung)

 

Und noch eine Stelle, die zu einer Warnung führt. Daher wäre folgende Änderung in ip_connection.c noch sinnvoll (hatte ich bisher von Hand geändert):

1275,1276c1275
<                       length = ((PacketHeader *)pending_data)->length;
---
>                       PacketHeader *ptr = (PacketHeader *)pending_data;
>                       length = ptr->length;

Geschrieben

Hm, gcc_struct kennt GCC nur für x86. Und ja, gcc_struct sollte auch im Header gesetzt werden, das ist aber nicht kritisch, da das Problem für das ich gcc_struct eingefügt hatte nur die .c Datei betrifft.

 

Als kurzfristigen Workaround kannst du für nicht-Windows Systeme das gcc_struct einfach streichen. In der nächsten Bindingsversion ist dass dann behoben.

 

Welche Warning macht denn die "length = ((PacketHeader *)pending_data)->length;" Zeile?

Geschrieben
  • Autor

Da kommt diese Meldung:

ip_connection.c: In function ‘void ipcon_receive_loop(void*)’:
ip_connection.c:1275:43: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.