In a recent note, Thomas Dickey said: > Date: Wed, 4 Apr 2001 05:04:12 -0400 > > > But I notice my comma-expression has been converted to a compound-statement. > > Was the comma-expression too bizarre, or did it threaten portability? > > well (my head's not too clear right now) - iirc, the issue was related to > whether I could ifdef-out the whole trace statement, that I noticed some > inconsistency in the set of ifdef's and related variables and rewrote the > whole thing. > I know it was conflicting with other changes in that area in dev.19. Since that's stabilized, I'm resubmitting it. In dev<=19, CTRACE expanded to an expression. In dev.20 it's a compound statement. This returns it to an expression, so it should be no worse than dev.19. If you ifdef-out the whole trace statement, it will still work in a statement context -- "CTRACE(( ... ));" becomes a dummy statement -- nothing is left but the ";". It will still fail in an expression context -- "( CTRACE(( ... )), 0 )" fails for "unexpected comma". But this would have been true at dev.19 or dev.20. -- gil -- StorageTek INFORMATION made POWERFUL
%%% Created Wed Apr 4 06:33:33 MDT 2001 by target lynx.patch. %%% diff -bru orig/lynx2-8-4/WWW/Library/Implementation/HTUtils.h lynx2-8-4/WWW/Library/Implementation/HTUtils.h --- orig/lynx2-8-4/WWW/Library/Implementation/HTUtils.h Sun Apr 1 18:51:46 2001 +++ lynx2-8-4/WWW/Library/Implementation/HTUtils.h Tue Apr 3 18:34:15 2001 @@ -498,13 +498,13 @@ #define TRACE_TRST (TRACE_bit(2)) #if defined(LY_TRACELINE) -#define LY_SHOWWHERE fprintf( tfp, "%s: %d: ", __FILE__, LY_TRACELINE ); +#define LY_SHOWWHERE fprintf( tfp, "%s: %d: ", __FILE__, LY_TRACELINE ), #else #define LY_SHOWWHERE /* nothing */ #endif -#define CTRACE(p) if (TRACE) { LY_SHOWWHERE fprintf p; } -#define CTRACE2(m,p) if (m) { LY_SHOWWHERE fprintf p; } +#define CTRACE(p) ((TRACE) && ( LY_SHOWWHERE fprintf p )) +#define CTRACE2(m,p) ((m) && ( LY_SHOWWHERE fprintf p )) #define tfp TraceFP() #define CTRACE_SLEEP(secs) if (TRACE && LYTraceLogFP == 0) sleep(secs) #define CTRACE_FLUSH(fp) if (TRACE) fflush(fp)