Bug #965

'FILE' undefined on -DEVEL?

Added by wa1ter over 6 years ago. Updated over 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

Description

While trying to build a pkgsrc package, the configure step failed because this
code won't compile on DFly:

#include <sys/types.h>
#include <inttypes.h>
#include <stdint.h>
#include <stddef.h>
#include <unistd.h>
#include <stdio.h>

typedef FILE ac__type_new_;
int
main ()
{
if ((ac__type_new_ *) 0)
return 0;
if (sizeof (ac__type_new_))
return 0;
;
return 0;
}

AFAICT, the reason is that FILE is undefined, or wrongly defined. The same
code compiles on the other BSDs and linux, so we are different somehow.

Is this by intention, and why?

Thanks.

History

#1 Updated by joerg over 6 years ago

FILE is an incomplete type. That is intentional. The only operation
ISO C90 and C99 allow on FILE are pointer ops. Copying is explicitly
prohibited. The most sane way to enforce that is to make it an
incomplete type. Checking the existance of FILE is just bogus.

Joerg

#2 Updated by jontro over 6 years ago

I think sizeof(FILE) is disabled intentionally. No program should depend on that
Regards
Jonas
On 3/9/08, walt <> wrote:
> While trying to build a pkgsrc package, the configure step failed because this
> code won't compile on DFly:
>
> #include <sys/types.h>
> #include <inttypes.h>
> #include <stdint.h>
> #include <stddef.h>
> #include <unistd.h>
> #include <stdio.h>
>
> typedef FILE ac__type_new_;
> int
> main ()
> {
> if ((ac__type_new_ *) 0)
> return 0;
> if (sizeof (ac__type_new_))
> return 0;
> ;
> return 0;
> }
>
> AFAICT, the reason is that FILE is undefined, or wrongly defined. The same
> code compiles on the other BSDs and linux, so we are different somehow.
>
> Is this by intention, and why?
>
> Thanks.
>
>

#3 Updated by rumcic over 6 years ago

type, search on pkgsrc-users for "[PATCH] databases/db4" for the patch to fix
this ;)

The POSIX/SUSv3 standards don't say anything about what FILE should be (other
than that it should be defined with typedef) ... so whatever it is, as long as
it's defined, it's standard compliant :P

#4 Updated by corecode over 5 years ago

nothing we will change

Also available in: Atom PDF