bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

base64.c:99 void function cannot return value


From: rv1971
Subject: base64.c:99 void function cannot return value
Date: Fri, 29 Nov 2013 11:52:48 +0100 (CET)

Dear all,

I'm using gnulib on Solaris with a Sun compiler:

$ uname -iprsv
SunOS 5.10 Generic_147440-27 sparc SUNW,SPARC-Enterprise
$ cc -V
Sun C 5.8 Patch 121015-05 2007/08/01

The compiler refuses to compile base64.c saying

"base64.c", line 99: void function cannot return value

Indeed, ISO/IEC 9899:TC3 clause 6.8.6.4 says: "A return statement with an 
expression shall not appear in a function whose return type is void." Unlike 
C++ (and many C compilers), this holds even when the expresion is a function 
call that returns void.

It is trivial to make base64.c compliant with this by the following patch:

*** base64.c.orig       Fri Nov 29 11:34:00 2013
--- base64.c    Fri Nov 29 11:34:19 2013
***************
*** 96,102 ****
       large inputs is to have both constraints satisfied, so we depend
       on both in base_encode_fast().  */
    if (outlen % 4 == 0 && inlen == outlen / 4 * 3)
!     return base64_encode_fast (in, inlen, out);
  
    while (inlen && outlen)
      {
--- 96,105 ----
       large inputs is to have both constraints satisfied, so we depend
       on both in base_encode_fast().  */
    if (outlen % 4 == 0 && inlen == outlen / 4 * 3)
!     {
!       base64_encode_fast (in, inlen, out);
!       return;
!     }
  
    while (inlen && outlen)
      {

I'd be happy if this patch could be incorporated.

Regards,
RV971

-- 
Diese E-Mail wurde aus dem Sicherheitsverbund E-Mail made in
Germany versendet: http://web.de/e-mail-made-in-germany



reply via email to

[Prev in Thread] Current Thread [Next in Thread]