[Nut-upsdev] building on Solaris 10 (was Re: 2.4.2 freeze)

Arjen de Korte nut+devel at de-korte.org
Tue Feb 16 08:40:00 UTC 2010


Citeren Tim Rice <tim op multitalents.net>:

> Much improvement. It went from 151 warnings to 57 warnings.

At least we're making progress...

> Of those, all but 5 were the "too many struct/union initializers" warnings.

Could you try if hardcoding the length of the subdrv_info array, fixes  
these warnings?

--- E:/nut/trunk/drivers/main.h	(revision 2349)
+++ E:/nut/trunk/drivers/main.h	(working copy)
@@ -59,7 +59,7 @@
  	const char	*version;	/* driver version */
  	const char	*authors;	/* authors name */
  	const int	status;		/* driver development status */
-	struct upsdrv_info_s	*subdrv_info[];	/* sub driver information */
+	struct upsdrv_info_s	*subdrv_info[2];	/* sub driver information */
  };

  typedef struct upsdrv_info_s	upsdrv_info_t;

Most likely, your compiler doesn't like the use of variable length  
arrays (which were introduced in C99). We can fix that later if this  
proves to be the problem (although it can be useful at times, I don't  
like the use here either).

> What is left are these.
> "/opt/src/utils/nut-2.4.1-r2349/drivers/upscode2.c", line 138:  
> warning: integer overflow detected: op "<<"
> "/opt/src/utils/nut-2.4.1-r2349/drivers/upscode2.c", line 138:  
> warning: initializer does not fit or is out of range: -2147483648
> "/opt/src/utils/nut-2.4.1-r2349/drivers/upscode2.c", line 540:  
> warning: integer overflow detected: op "<<"
> "/opt/src/utils/nut-2.4.1-r2349/drivers/upscode2.c", line 709:  
> warning: integer overflow detected: op "<<"
> "/opt/src/utils/nut-2.4.1-r2349/drivers/upscode2.c", line 713:  
> warning: integer overflow detected: op "<<"

That was stupid, I should have known that. The mask bits in a bit  
field must be unsigned. Fixed in r2350.

Best regards, Arjen
-- 
Please keep list traffic on the list




More information about the Nut-upsdev mailing list