From: SourceForge.net <no...@so...> - 2006-10-30 19:43:18
|
Support Requests item #1586760, was opened at 2006-10-29 17:17 Message generated for change (Comment added) made by bnollmeyer You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=200599&aid=1586760&group_id=599 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Closed Priority: 5 Private: No Submitted By: BNOLL (bnollmeyer) Assigned to: Maarten Brock (maartenbrock) Summary: SDCC Warning 187 occurs in malloc.h Initial Comment: Since Version 2.6 SDCC is reporting a warning 187: ISO C90 does not support flexible array members. The warning is related to malloc.h. The warning can be reproduced by using itoa, atoi, ltoa ... so please have a try. ---------------------------------------------------------------------- >Comment By: BNOLL (bnollmeyer) Date: 2006-10-30 19:43 Message: Logged In: YES user_id=1632898 Thanks Maarten, please let me know the changes in malloc.h ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2006-10-29 20:01 Message: Logged In: YES user_id=888171 Fixed in SDCC 2.6.1 #4443. The option --std-c99 means do not accept SDCC specific keywords like xdata, but only the C99 reserved keywords with leading double underscores like __xdata. It also means to accept C99 extensions to C90. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2006-10-29 19:35 Message: Logged In: YES user_id=888171 In general malloc tends to fragment the already limited memory. After a while it will no longer be able to allocate the requested memory. It is much safer to statically allocate the expected memory usage. But of course in the end it is the users choice. I'll fix the header file though as the struct defined in there is not to be used by the user. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2006-10-29 19:12 Message: Logged In: NO In general it is not recommended to use malloc in a small embedded system in the first place. Mmmh, if you try itoa, ltoa by using the SDCC LIB, malloc.h will we included by these functions. However, the warning is new since Version 2.6. --std-sdcc99 works fine, the other given option produces even more errors. Please explain the difference between V2.5, V2.6 in that specific case. ---------------------------------------------------------------------- Comment By: Jesus Calvino-Fraga (jesusc) Date: 2006-10-29 18:57 Message: Logged In: YES user_id=603650 >In general it is not recommended to use malloc in a small embedded system in the first place. Why? That is for the user to decide, not the compiler. I recently used malloc/realloc/free in a 8051 program and it worked extremelly well! In fact, I used working code compiled with MSVC and easily ported it to sdcc. With malloc() one can really take advantage of the limited memory of an embedded system. Jesus ---------------------------------------------------------------------- Comment By: Philipp Krause (spth) Date: 2006-10-29 18:02 Message: Logged In: YES user_id=564030 Warning exist to warn the user that he's likely to have done something wrong. Warnings caused by compiler internals, such as the implementation of malloc.h are not helpful, they just distract from the warnings that have meaning to the user. ---------------------------------------------------------------------- Comment By: Maarten Brock (maartenbrock) Date: 2006-10-29 17:53 Message: Logged In: YES user_id=888171 And the question is...? In general it is not recommended to use malloc in a small embedded system in the first place. And allthough C90 does not support flexible array members, SDCC handles them perfectly. If you compile with --std-c99 or --std-sdcc99 you will not get the warning. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=200599&aid=1586760&group_id=599 |