Make xschem build with configure option --CFLAGS="-std=c23" (prepare for gcc-15 issues)

This commit is contained in:
stefan schippers 2025-05-01 23:52:53 +02:00
parent 248fb1fd73
commit 0f49e3cda7
10 changed files with 66 additions and 66 deletions

View File

@ -2816,18 +2816,18 @@ void zoom_full(int dr, int sel, int flags, double shrink)
if(tclgetboolvar("change_lw")) {
xctx->lw = 1.;
}
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_WIDTH(xctx->lw);
xctx->areax1 = -2*INT_LINE_W(xctx->lw);
xctx->areay1 = -2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_LINE_W(xctx->lw);
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2 - xctx->areay1;
}
calc_drawing_bbox(&boundbox, sel);
dbg(1, "zoom_full: %s, %g %g %g %g\n",
xctx->current_win_path, boundbox.x1, boundbox.y1, boundbox.x2, boundbox.y2);
schw = xctx->areaw-4*INT_WIDTH(xctx->lw);
schh = xctx->areah-4*INT_WIDTH(xctx->lw);
schw = xctx->areaw-4*INT_LINE_W(xctx->lw);
schh = xctx->areah-4*INT_LINE_W(xctx->lw);
bboxw = boundbox.x2-boundbox.x1;
bboxh = boundbox.y2-boundbox.y1;
xctx->zoom = bboxw / schw;
@ -2895,10 +2895,10 @@ void set_viewport_size(int w, int h, double lw)
xctx->xrect[0].y = 0;
xctx->xrect[0].width = (unsigned short)w;
xctx->xrect[0].height = (unsigned short)h;
xctx->areax2 = w+2*INT_WIDTH(lw);
xctx->areay2 = h+2*INT_WIDTH(lw);
xctx->areax1 = -2*INT_WIDTH(lw);
xctx->areay1 = -2*INT_WIDTH(lw);
xctx->areax2 = w+2*INT_LINE_W(lw);
xctx->areay2 = h+2*INT_LINE_W(lw);
xctx->areax1 = -2*INT_LINE_W(lw);
xctx->areay1 = -2*INT_LINE_W(lw);
xctx->lw = lw;
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2-xctx->areay1;
@ -2920,10 +2920,10 @@ void save_restore_zoom(int save, Zoom_info *zi)
xctx->xrect[0].width = (unsigned short)zi->savew;
xctx->xrect[0].height = (unsigned short)zi->saveh;
dbg(1, "save_restore_zoom: restore width= %d, height=%d\n", xctx->xrect[0].width, xctx->xrect[0].height);
xctx->areax2 = zi->savew+2*INT_WIDTH(zi->savelw);
xctx->areay2 = zi->saveh+2*INT_WIDTH(zi->savelw);
xctx->areax1 = -2*INT_WIDTH(zi->savelw);
xctx->areay1 = -2*INT_WIDTH(zi->savelw);
xctx->areax2 = zi->savew+2*INT_LINE_W(zi->savelw);
xctx->areay2 = zi->saveh+2*INT_LINE_W(zi->savelw);
xctx->areax1 = -2*INT_LINE_W(zi->savelw);
xctx->areay1 = -2*INT_LINE_W(zi->savelw);
xctx->lw = zi->savelw;
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2-xctx->areay1;
@ -2940,8 +2940,8 @@ void zoom_box(double x1, double y1, double x2, double y2, double factor)
if(factor == 0.) factor = 1.;
RECTORDER(x1,y1,x2,y2);
xctx->xorigin=-x1;xctx->yorigin=-y1;
xctx->zoom=(x2-x1)/(xctx->areaw-4*INT_WIDTH(xctx->lw));
yy1=(y2-y1)/(xctx->areah-4*INT_WIDTH(xctx->lw));
xctx->zoom=(x2-x1)/(xctx->areaw-4*INT_LINE_W(xctx->lw));
yy1=(y2-y1)/(xctx->areah-4*INT_LINE_W(xctx->lw));
if(yy1>xctx->zoom) xctx->zoom=yy1;
xctx->zoom*= factor;
xctx->mooz=1/xctx->zoom;
@ -2964,8 +2964,8 @@ void zoom_rectangle(int what)
drawtemprect(xctx->gctiled, NOW, xctx->nl_xx1, xctx->nl_yy1, xctx->nl_xx2, xctx->nl_yy2);
if( xctx->nl_x1 != xctx->nl_x2 || xctx->nl_y1 != xctx->nl_y2) {
xctx->xorigin = -xctx->nl_x1; xctx->yorigin = -xctx->nl_y1;
xctx->zoom = (xctx->nl_x2 - xctx->nl_x1) / (xctx->areaw - 4 * INT_WIDTH(xctx->lw));
xctx->nl_yy1=(xctx->nl_y2 - xctx->nl_y1) / (xctx->areah - 4 * INT_WIDTH(xctx->lw));
xctx->zoom = (xctx->nl_x2 - xctx->nl_x1) / (xctx->areaw - 4 * INT_LINE_W(xctx->lw));
xctx->nl_yy1=(xctx->nl_y2 - xctx->nl_y1) / (xctx->areah - 4 * INT_LINE_W(xctx->lw));
if(xctx->nl_yy1 > xctx->zoom) xctx->zoom = xctx->nl_yy1;
xctx->mooz = 1 / xctx->zoom;
change_linewidth(-1.);
@ -3071,7 +3071,7 @@ void draw_stuff(void)
static void restore_selection(double x1, double y1, double x2, double y2)
{
double xx1,yy1,xx2,yy2;
int intlw = 2 * INT_WIDTH(xctx->lw) + (int)xctx->cadhalfdotsize;
int intlw = 2 * INT_LINE_W(xctx->lw) + (int)xctx->cadhalfdotsize;
xx1 = x1; yy1 = y1; xx2 = x2; yy2 = y2;
RECTORDER(xx1,yy1,xx2,yy2);
rebuild_selected_array();

View File

@ -1482,12 +1482,12 @@ static void draw_snap_cursor_shape(GC gc, double x, double y, int snapcursor_siz
static void erase_snap_cursor(double prev_x, double prev_y, int snapcursor_size) {
if (fix_broken_tiled_fill || !_unix) {
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
(int)X_TO_SCREEN(prev_x) - INT_WIDTH(xctx->lw) - snapcursor_size,
(int)Y_TO_SCREEN(prev_y) - INT_WIDTH(xctx->lw) - snapcursor_size,
2 * INT_WIDTH(xctx->lw) + 2 * snapcursor_size,
2 * INT_WIDTH(xctx->lw) + 2 * snapcursor_size,
(int)X_TO_SCREEN(prev_x) - INT_WIDTH(xctx->lw) - snapcursor_size,
(int)Y_TO_SCREEN(prev_y) - INT_WIDTH(xctx->lw) - snapcursor_size);
(int)X_TO_SCREEN(prev_x) - INT_LINE_W(xctx->lw) - snapcursor_size,
(int)Y_TO_SCREEN(prev_y) - INT_LINE_W(xctx->lw) - snapcursor_size,
2 * INT_LINE_W(xctx->lw) + 2 * snapcursor_size,
2 * INT_LINE_W(xctx->lw) + 2 * snapcursor_size,
(int)X_TO_SCREEN(prev_x) - INT_LINE_W(xctx->lw) - snapcursor_size,
(int)Y_TO_SCREEN(prev_y) - INT_LINE_W(xctx->lw) - snapcursor_size);
} else {
draw_snap_cursor_shape(xctx->gctiled, prev_x, prev_y, snapcursor_size);
}
@ -1547,7 +1547,7 @@ static void erase_crosshair(int size) {
int prev_cr_x = (int)X_TO_SCREEN(xctx->prev_crossx);
int prev_cr_y = (int)Y_TO_SCREEN(xctx->prev_crossy);
int lw = INT_WIDTH(xctx->lw);
int lw = INT_LINE_W(xctx->lw);
if(size) {
MyXCopyArea(display, xctx->save_pixmap, xctx->window, xctx->gc[0],
prev_cr_x - 1 * lw - size, prev_cr_y - 1 * lw - size, 2 * lw + 2 * size, 2 * lw + 2 * size,

View File

@ -5355,7 +5355,7 @@ void MyXCopyAreaDouble(Display* display, Drawable src, Drawable dest, GC gc,
{
double isx1, isy1, isx2, isy2, idx1, idy1;
unsigned int width, height;
int intlw = INT_WIDTH(lw);
int intlw = INT_LINE_W(lw);
dbg(1, "MyXCopyAreaDouble(%g, %g, %g, %g, intlw=%d)\n", sx1, sy1, sx2, sy2, intlw);
isx1=X_TO_SCREEN(sx1) - 2 * intlw;
isy1=Y_TO_SCREEN(sy1) - 2 * intlw;

View File

@ -37,7 +37,7 @@ static double rnd6(double x) {return round_to_n_digits(x, 6);}
struct fn
{
char *fname;
double (*fnct)();
double (*fnct)(double);
double value;
};
static int lex_state = 0;

View File

@ -1277,10 +1277,10 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
else
xctx->xrect[0].width = (short unsigned int) (xctx->xrect[0].height * pagey / pagex);
dbg(1, "create_ps(): xrect.width=%d, xrect.height=%d\n", xctx->xrect[0].width, xctx->xrect[0].height);
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_WIDTH(xctx->lw);
xctx->areax1 = -2*INT_LINE_W(xctx->lw);
xctx->areay1 = -2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_LINE_W(xctx->lw);
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2 - xctx->areay1;
dbg(1, "create_ps(): areax1=%d areay1=%d areax2=%d areay2=%d\n",
@ -1568,7 +1568,7 @@ void create_ps(char **psfile, int what, int fullzoom, int eps)
}
}
dbg(1, "ps_draw(): INT_WIDTH(lw)=%d plotfile=%s\n",INT_WIDTH(xctx->lw), xctx->plotfile);
dbg(1, "ps_draw(): INT_LINE_W(lw)=%d plotfile=%s\n",INT_LINE_W(xctx->lw), xctx->plotfile);
fprintf(fd, "showpage\n\n");
}
if(what & 4) { /* trailer */

View File

@ -2088,7 +2088,7 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
my_snprintf(res, S(res), "xrect[0].height=%d\n",
xctx->xrect[0].height); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "INT_WIDTH(lw)=%d\n", INT_WIDTH(xctx->lw)); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "INT_LINE_W(lw)=%d\n", INT_LINE_W(xctx->lw)); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "lw=%g\n", xctx->lw); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "wires=%d\n", xctx->wires); Tcl_AppendResult(interp, res, NULL);
my_snprintf(res, S(res), "instances=%d\n", xctx->instances); Tcl_AppendResult(interp, res, NULL);

View File

@ -684,17 +684,17 @@ void bbox(int what,double x1,double y1, double x2, double y2)
fprintf(errfp, "ERROR: bbox(SET) call before bbox(START)\n");
tcleval("alert_ {ERROR: bbox(SET) call before bbox(START)} {}");
}
xctx->areax1 = xctx->bbx1-2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->bbx2+2*INT_WIDTH(xctx->lw);
xctx->areay1 = xctx->bby1-2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->bby2+2*INT_WIDTH(xctx->lw);
xctx->areax1 = xctx->bbx1-2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->bbx2+2*INT_LINE_W(xctx->lw);
xctx->areay1 = xctx->bby1-2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->bby2+2*INT_LINE_W(xctx->lw);
xctx->areaw = (xctx->areax2-xctx->areax1);
xctx->areah = (xctx->areay2-xctx->areay1);
xctx->xrect[0].x = (short)(xctx->bbx1-INT_WIDTH(xctx->lw));
xctx->xrect[0].y = (short)(xctx->bby1-INT_WIDTH(xctx->lw));
xctx->xrect[0].width = (unsigned short)(xctx->bbx2-xctx->bbx1+2*INT_WIDTH(xctx->lw));
xctx->xrect[0].height = (unsigned short)(xctx->bby2-xctx->bby1+2*INT_WIDTH(xctx->lw));
xctx->xrect[0].x = (short)(xctx->bbx1-INT_LINE_W(xctx->lw));
xctx->xrect[0].y = (short)(xctx->bby1-INT_LINE_W(xctx->lw));
xctx->xrect[0].width = (unsigned short)(xctx->bbx2-xctx->bbx1+2*INT_LINE_W(xctx->lw));
xctx->xrect[0].height = (unsigned short)(xctx->bby2-xctx->bby1+2*INT_LINE_W(xctx->lw));
if(has_x) {
set_clip_mask(SET);
dbg(2, "bbox(SET): setting clip area: %d %d %d %d\n",
@ -709,17 +709,17 @@ void bbox(int what,double x1,double y1, double x2, double y2)
fprintf(errfp, "ERROR: bbox(SET_INSIDE) call before bbox(START)\n");
tcleval("alert_ {ERROR: bbox(SET_INSIDE) call before bbox(START)} {}");
}
xctx->areax1 = xctx->bbx1-2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->bbx2+2*INT_WIDTH(xctx->lw);
xctx->areay1 = xctx->bby1-2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->bby2+2*INT_WIDTH(xctx->lw);
xctx->areax1 = xctx->bbx1-2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->bbx2+2*INT_LINE_W(xctx->lw);
xctx->areay1 = xctx->bby1-2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->bby2+2*INT_LINE_W(xctx->lw);
xctx->areaw = (xctx->areax2-xctx->areax1);
xctx->areah = (xctx->areay2-xctx->areay1);
xctx->xrect[0].x = (short)(xctx->bbx1+INT_WIDTH(xctx->lw));
xctx->xrect[0].y = (short)(xctx->bby1+INT_WIDTH(xctx->lw));
xctx->xrect[0].width = (unsigned short)(xctx->bbx2-xctx->bbx1-2*INT_WIDTH(xctx->lw));
xctx->xrect[0].height = (unsigned short)(xctx->bby2-xctx->bby1-2*INT_WIDTH(xctx->lw));
xctx->xrect[0].x = (short)(xctx->bbx1+INT_LINE_W(xctx->lw));
xctx->xrect[0].y = (short)(xctx->bby1+INT_LINE_W(xctx->lw));
xctx->xrect[0].width = (unsigned short)(xctx->bbx2-xctx->bbx1-2*INT_LINE_W(xctx->lw));
xctx->xrect[0].height = (unsigned short)(xctx->bby2-xctx->bby1-2*INT_LINE_W(xctx->lw));
if(has_x) {
set_clip_mask(SET);
dbg(2, "bbox(SET): setting clip area: %d %d %d %d\n",

View File

@ -1151,7 +1151,7 @@ void svg_draw(void)
xctx->text[i].xscale, xctx->text[i].yscale);
}
dbg(1, "svg_draw(): INT_WIDTH(lw)=%d\n",INT_WIDTH(xctx->lw));
dbg(1, "svg_draw(): INT_LINE_W(lw)=%d\n",INT_LINE_W(xctx->lw));
fprintf(fd, "</svg>\n");
fclose(fd);
tclsetboolvar("draw_grid", old_grid);

View File

@ -2090,10 +2090,10 @@ void change_linewidth(double w)
XSetLineAttributes (display, xctx->gctiled, linew, LineSolid, LINECAP , LINEJOIN);
}
if(!xctx->only_probes) {
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_WIDTH(xctx->lw);
xctx->areax1 = -2*INT_LINE_W(xctx->lw);
xctx->areay1 = -2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->xrect[0].width+2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->xrect[0].height+2*INT_LINE_W(xctx->lw);
xctx->areaw = xctx->areax2-xctx->areax1;
xctx->areah = xctx->areay2 - xctx->areay1;
}
@ -2237,10 +2237,10 @@ void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h)
dbg(1, "resetwin(): create_pixmap=%d, clear_pixmap=%d, force=%d, width=%d, height=%d, pending_fullzoom=%d\n",
create_pixmap, clear_pixmap, force, width, height, xctx->pending_fullzoom);
/* if(wattr.map_state==IsUnmapped) return; */
xctx->areax2 = width + 2 * INT_WIDTH(xctx->lw);
xctx->areay2 = height + 2 * INT_WIDTH(xctx->lw);
xctx->areax1 = -2 * INT_WIDTH(xctx->lw);
xctx->areay1 = -2 * INT_WIDTH(xctx->lw);
xctx->areax2 = width + 2 * INT_LINE_W(xctx->lw);
xctx->areay2 = height + 2 * INT_LINE_W(xctx->lw);
xctx->areax1 = -2 * INT_LINE_W(xctx->lw);
xctx->areay1 = -2 * INT_LINE_W(xctx->lw);
xctx->areaw = xctx->areax2 - xctx->areax1;
xctx->areah = xctx->areay2 - xctx->areay1;
/* if no force avoid unnecessary work if no resize */
@ -2787,12 +2787,12 @@ int Tcl_AppInit(Tcl_Interp *inter)
if(cli_opt_flat_netlist) {
tclsetvar("flat_netlist","1");
}
xctx->areaw = CADWIDTH+4*INT_WIDTH(xctx->lw); /* clip area extends 1 pixel beyond physical xctx->window area */
xctx->areah = CADHEIGHT+4*INT_WIDTH(xctx->lw); /* to avoid drawing clipped rectangle borders at xctx->window edges */
xctx->areax1 = -2*INT_WIDTH(xctx->lw);
xctx->areay1 = -2*INT_WIDTH(xctx->lw);
xctx->areax2 = xctx->areaw-2*INT_WIDTH(xctx->lw);
xctx->areay2 = xctx->areah-2*INT_WIDTH(xctx->lw);
xctx->areaw = CADWIDTH+4*INT_LINE_W(xctx->lw); /* clip area extends 1 pixel beyond physical xctx->window area */
xctx->areah = CADHEIGHT+4*INT_LINE_W(xctx->lw); /* to avoid drawing clipped rectangle borders at xctx->window edges */
xctx->areax1 = -2*INT_LINE_W(xctx->lw);
xctx->areay1 = -2*INT_LINE_W(xctx->lw);
xctx->areax2 = xctx->areaw-2*INT_LINE_W(xctx->lw);
xctx->areay2 = xctx->areah-2*INT_LINE_W(xctx->lw);
xctx->xrect[0].x = 0;
xctx->xrect[0].y = 0;
xctx->xrect[0].width = CADWIDTH;

View File

@ -425,7 +425,7 @@ do { \
#define SWAP(a,b, tmp) do { tmp = a; a = b; b = tmp; } while(0)
#define XLINEWIDTH(x) MAJOR((tclgetboolvar("change_lw") ? ((int)(x) == 0 ? 1 : (int)(x)) : (int)(x)), xctx->min_lw)
#define INT_WIDTH(x) MAJOR(((int)(x) == 0 ? 1 : (int)(x)), xctx->min_lw)
#define INT_LINE_W(x) MAJOR(((int)(x) == 0 ? 1 : (int)(x)), xctx->min_lw)
#define INT_BUS_WIDTH(x) ( (int)( (BUS_WIDTH) * (x) ) == 0 ? 1 : (int)( (BUS_WIDTH) * (x) ) )
/* set do double if you need more precision at the expense of memory */