2024-04-24 03:07 AEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000346mercuryBugpublic2016-10-06 20:27
Assigned Towangp 
Product Version 
Target VersionFixed in Version 
Summary0000346: non-ANSI functions in header files
Descriptiondir.mih references DIR, but is included into C files compiled with gcc -ansi. For some reason this elicits an error from the gcc on AIX but seemingly not elsewhere.

There might be other similar problems.
TagsNo tags attached.
Attached Files




juliensf (administrator)

It might be worth adding the dir module to the list of files in library/Mercury.options that are compiled with --no-ansi.

OTOH, we should probably just not use -ansi at all -- IIRC, it (still) puts GCC into C90 mode (annoyingly it puts clang into C89 or GNU89 mode, which is slightly different).


wangp (developer)

Yes, I don't understand why dir.m hasn't required --no-ansi yet.

The bigger problem is that the non-ANSI stuff leaks into the header files generated for dir.m and ends up being included into almost everything else. That stuff should be hidden away, and only appear in `local' foreign_decls, foreign_codes, and foreign_procs marked `may_not_duplicate'.


juliensf (administrator)

I'd perfectly happy simply to not use -ansi with GCC. (I had to disable its use with clang recently anyway.)
Another problem with it is that it affects the compilation of user foreign_procs. Most of the systems we
support these days support POSIX / C99 well enough that disabling it isn't going to be a problem.
The one major system that doesn't, Windows, already requires special treatment everywhere anyway.


juliensf (administrator)

All that said, restricting the stuff in the dir module to appear in 'local' foreign pragmas is also a worthwhile
change IMO.


wangp (developer)

Fixed as part of commit 1fbcfe3 (for dir.m anyway)

-Issue History
Date Modified Username Field Change
2014-07-11 17:41 wangp New Issue
2014-07-11 20:08 juliensf Note Added: 0000739
2014-07-14 10:26 wangp Note Added: 0000743
2014-07-14 10:31 juliensf Note Added: 0000744
2014-07-14 10:33 juliensf Note Added: 0000745
2016-10-06 20:27 wangp Assigned To => wangp
2016-10-06 20:27 wangp Status new => resolved
2016-10-06 20:27 wangp Resolution open => fixed
2016-10-06 20:27 wangp Note Added: 0000934
+Issue History