Coda File System

Re: Building CVS coda

From: Nix <nix_at_esperi.demon.co.uk>
Date: 15 Jun 2002 00:38:04 +0100
On Thu, 13 Jun 2002, Jan Harkes said:
> On Thu, Jun 13, 2002 at 06:25:14PM +0900, Stephen J. Turnbull wrote:
>> c++ -fno-exceptions -fno-operator-names -MD -DHAVE_CONFIG_H -I. -I/home/steve/Projects/Coda/coda/include -I/home/steve/Projects/Coda/coda  -g -O2   -c -o dict.o dict.cc
>> In file included from dlist.h:42,
>>                  from dict.h:76,
>>                  from dict.cc:37:
>> /usr/include/stdio.h:295: parse error before `throw'
> 
> Ehh, what compiler are you using? the #include <stdio.h> is definitely
> within an extern "C" { } declaration, so it shouldn't complain about C++
> keywords in standard C header files.

extern "C" only changes linkage, and doesn't affect e.g. syntactic
correctness.

 7.5.7 in my draft C++ Standard covers this:

,----
| 7 Except for functions with internal linkage, a function first  declared
|   in  a  linkage-specification behaves as a function with external link-
|   age.  [Example:
|           extern "C" double f();
|           static double f();     // error
|   is ill-formed (_dcl.stc_).  ] The form of  linkage-specification  that
|   contains a braced-enclosed declaration-seq does not affect whether the
|   contained declarations are definitions or not (_basic.def_); the  form
|   of  linkage-specification  directly containing a single declaration is
|   treated as an extern specifier (_dcl.stc_) for the purpose  of  deter-
|   mining whether the contained declaration is a definition.  [Example:
|           extern "C" int i; // declaration
|           extern "C" {
|                   int i;    // definition
|           }
|    --end example]
`----

However, that's not the problem here. line 295 in glibc-2.2.5's stdio.h
reads:

/* Maximum chars of output to write in MAXLEN.  */
extern int snprintf (char *__restrict __s, size_t __maxlen,
		     __const char *__restrict __format, ...)
     __THROW __attribute__ ((__format__ (__printf__, 3, 4)));

where __THROW expands to throw() in C++ and nothing in C.

The fix is to take out -fno-exceptions, I think: g++ won't let
exception-specifications past under -fno-exceptions. (Yes, this means
-fno-exceptions in C++ on GNU/Linux and GNU/Hurd boxes is pretty
useless.)

-- 
`What happened?'
                 `Nick shipped buggy code!'
                                             `Oh, no dinner for him...'
Received on 2002-06-14 20:04:10