Bug 19077 - #define trace _nc_trace in /usr/include/ncurses.h causes collateral damage.
Summary: #define trace _nc_trace in /usr/include/ncurses.h causes collateral damage.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Peter Wemm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2000-06-07 01:00 UTC by pfeifer
Modified: 2000-07-11 03:37 UTC (History)
0 users

See Also:


Attachments
file.diff (433 bytes, patch)
2000-06-07 01:00 UTC, pfeifer
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description pfeifer 2000-06-07 01:00:00 UTC
The following change to /usr/include/ncurses.h which adds a
  #define trace _nc_trace
causes problems with our Wine port and probably further software:

  1.1.1.3 (vendor branch) Wed May 24 10:44:45 2000 UTC by peter
  CVS Tags: v5_0_19991023, HEAD; Branch: NCURSES

  Bring in the fix for the trace/_nc_trace issue, without breaking the
  vendor branching.  The author has fixed this also so we can do this
  safely.

  1.1.1.2.2.1 Tue May 23 13:42:17 2000 UTC by ache
  Branch: RELENG_4

  MFC: trace -> _nc_trace

For example, consider the following snippet:

  void _nc_trace() { }
  #define trace _nc_trace

  main() {
   long trace=0;

   if( &trace != &_nc_trace )
       printf("Okay\n");
   }
   
As another example, consider Wine, where this change causes:

  ../libwine.so: undefined reference to `__GET_DEBUGGING__nc_trace'

  due to a new interaction with the TRACE macro in debugtools.h.

  http://cvs.winehq.com/cvsweb/wine/include/debugtools.h?rev=1.9 has
  the source of that Wine include file.

The new #define in ncurses.h clearly breaks ANSI/ISO C compliant code.

Fix: a. Remove that #define.
b. Adding a stub instead of that #define.

Andrey A. Chernov <ache@freebsd.org> who introduced the breakage cannot
install a fix by himself, but suggested the following:
How-To-Repeat: Try the code snippet from "Full Description".
Compile the Wine port.
Comment 1 Will Andrews freebsd_committer freebsd_triage 2000-06-07 03:39:23 UTC
State Changed
From-To: open->feedback

I'm making this Peter's problem until it is fixed in the 
tree.  Right now, I can't build WINE because of this, and 
because a WINE PR is assigned to me, this does not make me 
happy.  Please fix this as soon as you can!  ;-) 


Comment 2 Will Andrews freebsd_committer freebsd_triage 2000-06-07 03:39:23 UTC
Responsible Changed
From-To: freebsd-bugs->peter

Peter's the one who imported "proper fix" to 5.0-CURRENT.
Comment 3 Garrett A. Wollman 2000-06-07 22:09:49 UTC
<<On Tue,  6 Jun 2000 16:50:24 -0700 (PDT), pfeifer@dbai.tuwien.ac.at said:

> The new #define in ncurses.h clearly breaks ANSI/ISO C compliant code.

<ncurses.h> is not an ANSI/ISO C header.

-GAWollman
Comment 4 Bruce Evans 2000-06-08 13:03:18 UTC
> The new #define in ncurses.h clearly breaks ANSI/ISO C compliant code.

It's clearly wrong (#define's are much more namespace-polluting than
extern variables an functions, as this example shows), but doesn't
break Standard C code any more than just including a nonStandard header
like <ncurses.h>.

Bruce
Comment 5 pfeifer 2000-06-08 14:27:49 UTC
On Thu, 8 Jun 2000, Bruce Evans wrote:
>> The new #define in ncurses.h clearly breaks ANSI/ISO C compliant code.
> It's clearly wrong (#define's are much more namespace-polluting than
> extern variables an functions, as this example shows), but doesn't
> break Standard C code any more than just including a nonStandard header
> like <ncurses.h>.

Yes, you're right. What I ment was that code which is ANSI/ISO C
compliant apart from #including system headers breaks.

Problem is, two people now pointed out that detail in my PR, but none
attacked the real problem! :-(

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/
Comment 6 nrahlstr freebsd_committer freebsd_triage 2000-07-11 03:35:36 UTC
State Changed
From-To: feedback->closed

Fixed by peter's import of ncurses 5.1 prerelease (20000701). 
Paul MFC'ed this to -stable.