Field initialization warnings

4 posts / 0 new
Last post
trixie
trixie's picture
Offline
Last seen: 5 months 13 hours ago
Joined: 2011-02-03 13:58
Field initialization warnings

I'm trying to fix all warnings in a source code I've taken over from somebody else. In the code there is a function inside which the following field is initialized:

  1. struct Elf32_SymbolQuery query2[] =
  2. {
  3. { ELF32_SQ_BYNAME, "EditEncoderProfile", 0, 0, FALSE, 0, 0 },
  4. { ELF32_SQ_BYNAME, "EncoderControl", 0, 0, FALSE, 0, 0 },
  5. };

The bit of code above produces two warnings:

1. missing braces around initializer
2. near initialization for 'query2[0].Sym'

What is actually wrong here, and how do I best get rid of the warnings?

Hans
Hans's picture
Offline
Last seen: 2 months 3 weeks ago
Joined: 2010-12-09 22:04
Based on the documentation

Based on the documentation found here, I'd say that the problem is the last element in struct Elf32_SymbolQuery:

  1. struct Elf32_SymbolQuery
  2. {
  3. uint32 Flags;
  4. STRPTR Name;
  5. uint32 NameLength;
  6. uint32 Value;
  7. BOOL Found;
  8. uint16 pad1;
  9. Elf32_Sym Sym;
  10. };

AFAIK, Elf32_Sym is a typedef for another structure.

Hans

http://hdrlab.org.nz/ - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.
http://keasigmadelta.co.nz/ - more of my software.

salass00
salass00's picture
Offline
Last seen: 1 year 1 month ago
Joined: 2011-02-03 11:27
As Hans said Elf32_Sym is

As Hans said Elf32_Sym is another structure so you should change your code to:

  1. struct Elf32_SymbolQuery query2[] =
  2. {
  3. { ELF32_SQ_BYNAME, "EditEncoderProfile", 0, 0, FALSE, 0, { 0 } },
  4. { ELF32_SQ_BYNAME, "EncoderControl", 0, 0, FALSE, 0, { 0 } },
  5. };
trixie
trixie's picture
Offline
Last seen: 5 months 13 hours ago
Joined: 2011-02-03 13:58
@Hans & salass00 Thank you

@Hans & salass00

Thank you very much!

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

Log in or register to post comments