Article View: gnu.gcc.bug
Article #26101.35 #pragma once bug/fix
From: Ron Guilmette
Date: Mon, 08 May 1989 16:18
Date: Mon, 08 May 1989 16:18
38 lines
1739 bytes
1739 bytes
If any of you out there in GNU-land have tried to use the new cpp
#pragma once feature, will no doubt have realized that it is broke.
Essentially, files which contain #pragma once in them are re-opened
for the second and subsequent includes (don't ask me why).
Unfortunately in these "second and subsequent" cases, there is no
corresponding close(), so you end up with too many open files
eventually. The following patch fixes the problem. The line
numbers may be a little off from those in an "out-of-the-box"
1.35 distribution, but don't worry about that.
diff -rc2 1.35--/cccp.c 1.35-+/cccp.c
*** 1.35--/cccp.c Mon Apr 10 16:53:16 1989
--- 1.35-+/cccp.c Wed Apr 26 18:37:58 1989
***************
*** 2492,2497 ****
for (ptr = dont_repeat_files; ptr; ptr = ptr->next) {
! if (!strcmp (ptr->fname, fname))
return; /* This file was once'd. */
}
--- 2520,2527 ----
for (ptr = dont_repeat_files; ptr; ptr = ptr->next) {
! if (!strcmp (ptr->fname, fname)) {
! close (f);
return; /* This file was once'd. */
+ }
}
// Ron Guilmette - MCC - Experimental Systems Kit Project
// 3500 West Balcones Center Drive, Austin, TX 78759 - (512)338-3740
// ARPA: rfg@mcc.com
// UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg
Technical Details
Message-ID:
<8905081618.AA06596@riunite.aca.mcc.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!tut.cis.ohio-state.edu!MCC.COM!rfgShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!rutgers!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.gcc.bug Subject: 1.35 #pragma once bug/fix Message-ID: <8905081618.AA06596@riunite.aca.mcc.com> Date: 8 May 89 16:18:02 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 38