Skip to content

Commit 1f718e3

Browse files
committed
kernel: Remove global tcl.h include
In commit ac988cf we made sure to undefine the CONST/VOID macros left defined by `tcl.h`, but this in turn makes it an issue to include additional Tcl headers later on (see issue #4808). One way out is to avoid a global `tcl.h` include. In the process we drop support for Tcl-enabled MXE builds, which were likely broken anyway due to the additional Tcl APIs used from `tclapi.cc`.
1 parent 87736a2 commit 1f718e3

File tree

6 files changed

+16
-26
lines changed

6 files changed

+16
-26
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ endif
305305
else ifeq ($(CONFIG),mxe)
306306
PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
307307
CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++
308-
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL) -D_POSIX_SOURCE -DYOSYS_MXE_HACKS -Wno-attributes
308+
CXXFLAGS += -std=$(CXXSTD) $(OPT_LEVEL) -D_POSIX_SOURCE -Wno-attributes
309309
CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
310310
LINKFLAGS := $(filter-out -rdynamic,$(LINKFLAGS)) -s
311311
LIBS := $(filter-out -lrt,$(LIBS))

kernel/driver.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
# include <editline/readline.h>
3232
#endif
3333

34+
#ifdef YOSYS_ENABLE_TCL
35+
# include <tcl.h>
36+
#endif
37+
3438
#include <stdio.h>
3539
#include <string.h>
3640
#include <limits.h>

kernel/tclapi.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
#include "libs/json11/json11.hpp"
2323

2424
#ifdef YOSYS_ENABLE_TCL
25-
#include "tclTomMath.h"
26-
#include "tclTomMathDecls.h"
25+
#include <tcl.h>
26+
#include <tclTomMath.h>
27+
#include <tclTomMathDecls.h>
2728
#endif
2829

2930
YOSYS_NAMESPACE_BEGIN

kernel/yosys.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
# include <editline/readline.h>
3030
#endif
3131

32+
#ifdef YOSYS_ENABLE_TCL
33+
# include <tcl.h>
34+
#endif
35+
3236
#ifdef YOSYS_ENABLE_PLUGINS
3337
# include <dlfcn.h>
3438
#endif

kernel/yosys.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
#include "kernel/rtlil.h"
4444
#include "kernel/register.h"
4545

46+
#ifdef YOSYS_ENABLE_TCL
47+
struct Tcl_Interp;
48+
#endif
49+
4650
YOSYS_NAMESPACE_BEGIN
4751

4852
void yosys_setup();

kernel/yosys_common.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,6 @@
6565
#define FRIEND_TEST(test_case_name, test_name) \
6666
friend class test_case_name##_##test_name##_Test
6767

68-
#ifdef YOSYS_ENABLE_TCL
69-
# include <tcl.h>
70-
# ifdef YOSYS_MXE_HACKS
71-
extern Tcl_Command Tcl_CreateCommand(Tcl_Interp *interp, const char *cmdName, Tcl_CmdProc *proc, ClientData clientData, Tcl_CmdDeleteProc *deleteProc);
72-
extern Tcl_Interp *Tcl_CreateInterp(void);
73-
extern void Tcl_Preserve(ClientData data);
74-
extern void Tcl_Release(ClientData clientData);
75-
extern int Tcl_InterpDeleted(Tcl_Interp *interp);
76-
extern void Tcl_DeleteInterp(Tcl_Interp *interp);
77-
extern int Tcl_Eval(Tcl_Interp *interp, const char *script);
78-
extern int Tcl_EvalFile(Tcl_Interp *interp, const char *fileName);
79-
extern void Tcl_Finalize(void);
80-
extern int Tcl_GetCommandInfo(Tcl_Interp *interp, const char *cmdName, Tcl_CmdInfo *infoPtr);
81-
extern const char *Tcl_GetStringResult(Tcl_Interp *interp);
82-
extern Tcl_Obj *Tcl_NewStringObj(const char *bytes, int length);
83-
extern Tcl_Obj *Tcl_NewIntObj(int intValue);
84-
extern Tcl_Obj *Tcl_NewListObj(int objc, Tcl_Obj *const objv[]);
85-
extern Tcl_Obj *Tcl_ObjSetVar2(Tcl_Interp *interp, Tcl_Obj *part1Ptr, Tcl_Obj *part2Ptr, Tcl_Obj *newValuePtr, int flags);
86-
# endif
87-
# undef CONST
88-
# undef INLINE
89-
#endif
90-
9168
#ifdef _WIN32
9269
# undef NOMINMAX
9370
# define NOMINMAX 1

0 commit comments

Comments
 (0)