URL:
<http://gna.org/bugs/?14387>
Summary: Array declaration is not compile-time constant
Project: Freeciv
Submitted by: elmo
Submitted on: Monday 09/28/2009 at 15:24
Category: None
Severity: 2 - Minor
Priority: 5 - Normal
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release:
Discussion Lock: Any
Operating System: None
Planned Release: None
_______________________________________________________
Details:
Trying to compile FreeCiv with clang gave me the following error:
console.c:139:15: error: variable length array declaration can not have
'static' storage duration
static char buf1[(int)trunc(MAX_LEN_CONSOLE_LINE * 1.5)];
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trunc() seems completely bogus here.
The fix is simple enough:
$ svn diff
Index: server/console.c
===================================================================
--- server/console.c (revision 16001)
+++ server/console.c (working copy)
@@ -136,7 +136,7 @@
void con_write(enum rfc_status rfc_status, const char *message, ...)
{
/* First buffer contains featured text tags */
- static char buf1[(int)trunc(MAX_LEN_CONSOLE_LINE * 1.5)];
+ static char buf1[(int)(MAX_LEN_CONSOLE_LINE * 1.5)];
static char buf2[MAX_LEN_CONSOLE_LINE];
va_list args;
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?14387>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev