[3382] in Athena Bugs

home help back first fref pref prev next nref lref last post

hc2 preprocessor

daemon@ATHENA.MIT.EDU (John Carr)
Sat Oct 7 06:34:53 1989

To: bugs@ATHENA.MIT.EDU
Date: Sat, 07 Oct 89 06:34:32 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>

The following file shows two bugs in the hc2 preprocessor (current
version as well as 2.1s).  The comments mark the lines which seem to
cause trouble (two lines which can be removed to cause a core dump,
one line which needs to be removed or modified to make it work right).
This is the preprocessed output from the included file:

 ((((&pScreenPriv->saved))->x1 <= ((sx)+(pDrawable->x)+(w))) &&
  (((sx)+(pDrawable->x)) <= ((&pScreenPriv->saved))->x2) &&
  (((&pScreenPriv->saved))->y1 <= ((sy)+(pDrawable->y)+(h))) &&
  (((sy)+(pDrawable->y)) <= ((&pScreenPriv->saved))->)))
                                                    ^^^
                                          note missing "y2" here

----------------
#define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \
 	(((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \
	 ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2))

#define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \
    BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h))

/* Remove the following line, or change the macro arguments to
   upper case, to make it work correctly (hypothesis: hc2 continues
   to think of "y2" as a macro parameter even after the end of this macro). */
#define LINE_SORT(x1,y2,x2,y2) \
{ int _t; \
  if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \
  if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } }

/* Remove the following line to cause a core dump */
#define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
    BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))

#ifndef DIXFONTSTRUCT_H
/* Remove the following line to make hc core dump */
#define DIXFONTSTRUCT_H
#endif /* DIXFONTSTRUCT_H */

ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h))

----------------

home help back first fref pref prev next nref lref last post