DragonFly BSD
DragonFly users List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: A gcc puzzle for the experts


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Tue, 25 Jan 2005 16:57:33 -0800

On Tue, 25 Jan 2005 16:24:42 -0800
walt <wa1ter@xxxxxxxxxxxxx> wrote:

> The problem is that the gnomevfs2 port won't compile on my
> gcc34 machine, but compiles perfectly on the gcc2 machine
> and on FreeBSD-CURRENT (gcc 3.4.2).
> 
> This is the error:
> cdda-method.c:647: error: syntax error before "else"
> 
> and this is the offending code:
> 
>         /* Check and see if we already have opened and stashed this drive */
>         if (!use_base) {
>                 if (global_context != NULL) {
> #ifdef __linux__
>                         if (strcmp (drive->cdda_device_name,
> global_context->drive->cdda_device_name) == 0) {
> #elif defined(__FreeBSD__)
>                         if (strcmp (drive->dev->device_path,
> global_context->drive->dev->device_path) == 0) {
> #endif

This is not a very good use of conditional-compilation directives...
If neither __linux__ nor __FreeBSD__ is defined, there will be no 'if'!
Which of course means 'else' will be a syntax error :)

>                                 use_cache = TRUE;
>                                 cdda_close (drive);
>                                 gnome_vfs_file_info_copy (file_info,
> global_context->file_info);
>                         } else {
>                                 /* We have a new drive. */
>                                 cdda_context_free (global_context);
>                                 global_context = cdda_context_new (drive, uri);
>                                 cdda_set_file_info_for_root (global_context,
> uri);
>                                 gnome_vfs_file_info_copy (file_info,
> global_context->file_info);
>                         }
>                 } else {				<========  line 647
>                         /* Create a new context */
>                         global_context = cdda_context_new (drive, uri);
> <remainder of sourcefile snipped>
> 
> The error occurs even if I change __FreeBSD__ to __DragonFly__ because
> the error is a *syntax* error, not an undefined symbol or missing header.

What happens if you change the #elif line to just "#else" ?

> So, anyone have a clue what is wrong -- anyone else getting the same error?
> 
> 

-Chris



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