Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,6 @@ install: install-software install-docs

install-software: install-kernel-dep install-kernel-indep install-menu


# buster gcc (Debian 8.3.0-6) emits many warnings
# use at your own risk
ifeq ($(origin SUPPRESS_WARNINGS), undefined)
else
QUIETFLAGS ?=
QUIETFLAGS += -Wno-unused-label
QUIETFLAGS += -Wno-format-overflow
QUIETFLAGS += -Wno-format-truncation
QUIETFLAGS += -Wno-stringop-truncation
CXXQUIETFLAGS := $(QUIETFLAGS)
CXXQUIETFLAGS += -Wno-catch-value
endif

ifeq ($(origin KERNELRELEASE), undefined)
MAKEFLAGS += --warn-undefined-variables
endif
Expand Down Expand Up @@ -258,11 +244,17 @@ INCLUDE += $(LIBTIRPC_CFLAGS)
# Compilation options. Perhaps some of these should come from Makefile.inc? (CXXFLAGS now does)
INTEGER_OVERFLOW_FLAGS := -fwrapv
OPT := -Os $(INTEGER_OVERFLOW_FLAGS)
DEBUG := $(DEBUG) -g -Wall
DEBUG := $(DEBUG) -g -Wall -Wno-stringop-truncation
CFLAGS := $(INCLUDE) $(OPT) $(DEBUG) $(EXTRA_DEBUG) -DULAPI -std=gnu99 -fgnu89-inline -Werror=implicit-function-declaration $(CFLAGS) $(CPPFLAGS)
CXXFLAGS := $(INCLUDE) $(EXTRA_DEBUG) -DULAPI $(DEBUG) $(OPT) -Woverloaded-virtual $(CXXFLAGS) $(CPPFLAGS)
CXXFLAGS += $(call cxx-option, -Wno-psabi)
CXXFLAGS += $(call cxx-option, -std=gnu++11, -std=gnu++0x)
# In Debian 11, any inclusion of <boost/python.hpp> leads to several
# diagnostics from included headers about deprecated features. LinuxCNC does
# not directly use these deprecated features, but it does use boost::python.
# Silence the warnings just when they occur in files using boost/python.hpp by
# adding SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS to the object's EXTRAFLAGS
SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS = -DBOOST_ALLOW_DEPRECATED_HEADERS=1 -DBOOST_BIND_GLOBAL_PLACEHOLDERS=1

CFLAGS += $(TOOL_NML_FLAG)
CXXFLAGS += $(TOOL_NML_FLAG)
Expand Down Expand Up @@ -644,7 +636,7 @@ install install-software install-docs:

MENUS = ../share/menus/CNC.menu \
../share/desktop-directories/cnc.directory
install-menus install-menu: $(MENUS) $(XDGDESKTOP)
rip-install-menus rip-install-menu: $(MENUS) $(XDGDESKTOP)
mkdir -p $(HOME)/.config/menus/applications-merged
cp $< $(HOME)/.config/menus/applications-merged
else
Expand Down
4 changes: 2 additions & 2 deletions src/emc/kinematics/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ USERSRCS += $(GENSERKINSSRCS)

DELTAMODULESRCS := emc/kinematics/lineardeltakins.cc
PYSRCS += $(DELTAMODULESRCS)
$(call TOOBJS, $(DELTAMODULESRCS)): CFLAGS += -x c++ -Wno-declaration-after-statement
$(call TOOBJS, $(DELTAMODULESRCS)): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS)

DELTAMODULE := ../lib/python/lineardeltakins.so
$(DELTAMODULE): $(call TOOBJS, $(DELTAMODULESRCS))
Expand All @@ -27,7 +27,7 @@ TARGETS += ../bin/genserkins

RDELTAMODULESRCS := emc/kinematics/rotarydeltakins.cc
PYSRCS += $(RDELTAMODULESRCS)
$(call TOOBJS, $(RDELTAMODULESRCS)): CFLAGS += -x c++ -Wno-declaration-after-statement
$(call TOOBJS, $(RDELTAMODULESRCS)): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS)

RDELTAMODULE := ../lib/python/rotarydeltakins.so
$(RDELTAMODULE): $(call TOOBJS, $(RDELTAMODULESRCS))
Expand Down
3 changes: 2 additions & 1 deletion src/emc/rs274ngc/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ LIBRS274SRCS := $(addprefix emc/rs274ngc/, \
interp_inspection.cc)
USERSRCS += $(LIBRS274SRCS)

$(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS=-fPIC $(BOOST_DEBUG_FLAGS)
$(call TOOBJSDEPS, $(LIBRS274SRCS)) : EXTRAFLAGS+=-fPIC $(BOOST_DEBUG_FLAGS)
$(call TOOBJSDEPS, emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyparamclass.cc emc/rs274ngc/pyinterp1.cc emc/rs274ngc/pyblock.cc emc/rs274ngc/pyarrays.cc emc/rs274ngc/interpmodule.cc): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS)

TARGETS += ../lib/librs274.so ../lib/librs274.so.0

Expand Down
3 changes: 2 additions & 1 deletion src/emc/rs274ngc/array1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
#ifndef BOOST_PYTHON_MAX_ARITY
#define BOOST_PYTHON_MAX_ARITY 4
#endif
#include <boost/python/iterator.hpp>
#include <boost/python/class.hpp>
#include <boost/python/object/class_detail.hpp>
#include <boost/python/enum.hpp>
#include <boost/python/object.hpp>
#include <boost/python/scope.hpp>
Expand Down
2 changes: 2 additions & 0 deletions src/emc/task/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ MILLTASKSRCS := \
emc/task/taskclass.cc \
emc/task/backtrace.cc \

$(call TOOBJSDEPS, emc/task/taskmodule.cc): EXTRAFLAGS += $(SILENCE_BOOST_INTERNAL_DIAGNOSTICS_FLAGS)

USERSRCS += $(MILLTASKSRCS)

#LDFLAGS +=
Expand Down
6 changes: 3 additions & 3 deletions src/emc/task/emctask.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int emcTaskInit()
// set the user_defined_fmt string with dirname
// note the %%02d means 2 digits after the M code
// and we need two % to get the literal %
ret = snprintf(user_defined_fmt[dct], sizeof(user_defined_fmt[0]),
ret = snprintf(user_defined_fmt[dct], sizeof(user_defined_fmt[dct]),
"%s/M1%%02d", expanddir); // update global
if(ret >= sizeof(user_defined_fmt[0])){
return -EMSGSIZE; // name truncated
Expand Down Expand Up @@ -217,13 +217,13 @@ int emcTaskHalt()

int emcTaskStateRestore()
{
int res;
int res = 0;
// Do NOT restore on MDI command
if (emcStatus->task.mode == EMC_TASK_MODE_AUTO) {
// Validity of state tag checked within restore function
res = pinterp->restore_from_tag(emcStatus->motion.traj.tag);
}
return 0;
return res;
}

int emcTaskAbort()
Expand Down
4 changes: 2 additions & 2 deletions src/emc/usr_intf/emclcd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1705,9 +1705,9 @@ int main(int argc, char *argv[])
while((opt = getopt_long(argc, argv, "p:d:a", longopts, NULL)) != -1) {
switch(opt) {
case 'a': autoStart = 1; break;
case 'd': strncpy(driver, optarg, strlen(optarg) + 1); break;
case 'd': snprintf(driver, sizeof(driver), "%s", optarg); break;
case 'p': sscanf(optarg, "%d", &port); break;
case 's': strncpy(server, optarg, strlen(optarg) + 1); break;
case 's': snprintf(server, sizeof(server), "%s", optarg); break;
case 'w': sscanf(optarg, "%f", &delay); break;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/emc/usr_intf/emcrsh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2939,12 +2939,12 @@ int main(int argc, char *argv[])
while((opt = getopt_long(argc, argv, "he:n:p:s:w:d:", longopts, NULL)) != - 1) {
switch(opt) {
case 'h': usage(argv[0]); exit(1);
case 'e': strncpy(enablePWD, optarg, strlen(optarg) + 1); break;
case 'n': strncpy(serverName, optarg, strlen(optarg) + 1); break;
case 'e': snprintf(enablePWD, sizeof(enablePWD), "%s", optarg); break;
case 'n': snprintf(serverName, sizeof(serverName), "%s", optarg); break;
case 'p': sscanf(optarg, "%d", &port); break;
case 's': sscanf(optarg, "%d", &maxSessions); break;
case 'w': strncpy(pwd, optarg, strlen(optarg) + 1); break;
case 'd': strncpy(defaultPath, optarg, strlen(optarg) + 1);
case 'w': snprintf(pwd, sizeof(pwd), "%s", optarg); break;
case 'd': snprintf(defaultPath, sizeof(defaultPath), "%s", optarg); break;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/emc/usr_intf/schedrmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1254,12 +1254,12 @@ int main(int argc, char *argv[])
// process local command line args
while((opt = getopt_long(argc, argv, "e:n:p:s:w:", longopts, NULL)) != -1) {
switch(opt) {
case 'e': strncpy(enablePWD, optarg, strlen(optarg) + 1); break;
case 'n': strncpy(serverName, optarg, strlen(optarg) + 1); break;
case 'e': snprintf(enablePWD, sizeof(enablePWD), "%s", optarg); break;
case 'n': snprintf(serverName, sizeof(serverName), "%s", optarg); break;
case 'p': sscanf(optarg, "%d", &port); break;
case 's': sscanf(optarg, "%d", &maxSessions); break;
case 'w': strncpy(pwd, optarg, strlen(optarg) + 1); break;
case 'd': strncpy(defaultPath, optarg, strlen(optarg) + 1);
case 'w': snprintf(pwd, sizeof(pwd), "%s", optarg); break;
case 'd': snprintf(defaultPath, sizeof(defaultPath), "%s", optarg); break;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hal/classicladder/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ CLASSICLADDERSRCS := $(addprefix hal/classicladder/, \
vars_access.c \
)

GTK2_CFLAGS += -DGTK_INTERFACE -DGTK2
GTK2_CFLAGS += -DGTK_INTERFACE -DGTK2 -Wno-deprecated-declarations
ifeq ($(HAVE_GNOMEPRINT),yes)
CLASSICLADDERSRCS += hal/classicladder/print_gnome.c
GTK2_CFLAGS += -DGNOME_PRINT_USE
Expand Down
4 changes: 2 additions & 2 deletions src/hal/components/Submakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ CONVERTERS := \
conv_bit_s32.comp conv_bit_u32.comp conv_bit_float.comp \
conv_s32_float.comp conv_s32_bit.comp conv_s32_u32.comp \
conv_u32_float.comp conv_u32_bit.comp conv_u32_s32.comp
COMPS := $(sort $(wildcard hal/components/*.comp) $(addprefix hal/components/, $(CONVERTERS)))
COMP_MANPAGES := $(patsubst hal/components/%.comp, ../docs/man/man9/%.9, $(COMPS))
COMPS := $(filter-out hal/components/tpcomp.comp, $(sort $(wildcard hal/components/*.comp) $(addprefix hal/components/, $(CONVERTERS))))
COMP_MANPAGES := $(patsubst hal/components/%.comp, ../docs/man/man9/%.9, $(COMPS)) ../docs/man/man9/tpcomp.9
ifeq ($(BUILD_SYS),uspace)
COMP_DRIVERS += hal/drivers/serport.comp
COMP_DRIVERS += hal/drivers/mesa_7i65.comp
Expand Down
7 changes: 2 additions & 5 deletions src/hal/components/tpcomp.comp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ option extra_setup;
#include USE_TOPDIR(src/libnml/posemath/_posemath.c)
#include USE_TOPDIR(src/libnml/posemath/sincos.c)

#else
#error No TOPDIR defined, skeleton component provides no trajectory planning functions.
#endif // }
//=====================================================================

Expand All @@ -80,12 +82,7 @@ RTAPI_MP_STRING(tp_parms,"Example tp parms");
EXTRA_SETUP() {
if (!tp_parms) {tp_parms="no_tp_parms";}
rtapi_print("@@@%s:%s: tp_parms=%s\n",__FILE__,__FUNCTION__,tp_parms);
#ifndef TOPDIR
#warning No TOPDIR defined, skeleton component provides no trajectory planning functions.
rtapi_print("\n!!!%s: NO Trajectory Planning symbols provided\n\n",__FILE__);
#else
rtapi_print("\n@@@%s: TOPDIR=%s\n",__FILE__,XSTR(TOPDIR));
#endif
return 0;
}
#undef USE_TOPDIR
Expand Down
2 changes: 1 addition & 1 deletion src/hal/user_comps/mb2hal/mb2hal_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ retCode parse_pin_names(const char * names_string, mb_tx_t *this_mb_tx)
retCode parse_transaction_section(const int mb_tx_num)
{
char *fnct_name = "parse_transaction_section";
char section[20];
char section[40];
char *tag;
const char *tmpstr;
mb_tx_t *this_mb_tx;
Expand Down
46 changes: 25 additions & 21 deletions src/hal/utils/halcmd_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@
#include <fnmatch.h>
#include <search.h>

static char *vseprintf(char *buf, char *ebuf, const char *fmt, va_list ap) {
int result = vsnprintf(buf, ebuf-buf, fmt, ap);
if(result < 0) return ebuf;
else if(buf + result > ebuf) return ebuf;
else return buf + result;
}

static char *seprintf(char *buf, char *ebuf, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
char *result = vseprintf(buf, ebuf, fmt, ap);
va_end(ap);
return result;
}

static int get_input(FILE *srcfile, char *buf, size_t bufsize);
static void print_help_general(int showR);
static int release_HAL_mutex(void);
Expand Down Expand Up @@ -255,49 +270,36 @@ int main(int argc, char **argv)
}
} else {
int extend_ct = 0; // extend lines with backslash (\)
char *elinenext = 0;
char eline [(LINELEN + 2) * (MAX_EXTEND_LINES + 1)] = {0,};
char *elineptr=eline, *elineend=eline + sizeof(eline);
/* read command line(s) from 'srcfile' */
while (get_input(srcfile, raw_buf, MAX_CMD_LEN)) {
char *tokens[MAX_TOK+1];
char eline [(LINELEN + 2) * (MAX_EXTEND_LINES + 1)];
char *elineptr;
int newLinePos;

halcmd_set_linenumber(linenumber++);

newLinePos = (int)strlen(raw_buf) - 1; // interactive
if (raw_buf[newLinePos] == '\n') { newLinePos--; } // tty
if (raw_buf[newLinePos] == '\n') { raw_buf[newLinePos]=0; newLinePos--; } // tty

if (newLinePos > 0 && raw_buf[newLinePos] == '\\') { // backslash
if (raw_buf[newLinePos] == '\\') { // backslash
raw_buf[newLinePos] = 0;
newLinePos++;
if (!extend_ct) { //first extend
if (prompt == prompt_interactive) prompt = prompt_continue;
elineptr = eline;
strncpy(elineptr,raw_buf,strlen(raw_buf));
elinenext = elineptr + strlen(raw_buf);
} else { // subsequent extends
strncpy(elinenext,raw_buf,newLinePos);
elinenext = elinenext + strlen(raw_buf);
}
*elinenext = 0;
elineptr = seprintf(elineptr, elineend, "%s", raw_buf);
extend_ct++;
continue; // get next line to extend
} else { // no backslash
if (extend_ct) { // extend finished
strncpy(elinenext,raw_buf,strlen(raw_buf));
*(eline+strlen(eline)+0)='\n';
elinenext = elinenext + strlen(raw_buf);
*elinenext = 0;
elineptr = eline;
}
elineptr = seprintf(elineptr, elineend, "%s", raw_buf);
}
if (!extend_ct) { elineptr = (char*)raw_buf; }
extend_ct = 0;
if (prompt == prompt_continue) { prompt = prompt_interactive; }

/* remove comments, do var substitution, and tokenise */
retval = halcmd_preprocess_line(elineptr, tokens);
retval = halcmd_preprocess_line(eline, tokens);

if(echo_mode) {
halcmd_echo("%s\n", eline);
}
Expand All @@ -324,6 +326,8 @@ int main(int argc, char **argv)
/* exit from loop */
break;
}
elineptr=eline;
*eline = 0;
} //while get_input()
extend_ct=0;
}
Expand Down
10 changes: 5 additions & 5 deletions src/hal/utils/halrmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1479,7 +1479,7 @@ static int doLoadUsr(char *args[])
/* get program and component name */
if(name_flag) {
new_comp_name = *args++;
prog_name = *args++;
prog_name = *args++;
} else {
new_comp_name = prog_name = *args++;
}
Expand Down Expand Up @@ -2880,7 +2880,7 @@ static cmdResponseType setUnload(char *s, connectionRecType *context)

static cmdResponseType setLoadUsr(char *s, connectionRecType *context)
{
char *argv[MAX_TOK+1];
char *argv[MAX_TOK+1] = {0};

argv[0] = s;
argv[1] = "\0";
Expand Down Expand Up @@ -3472,11 +3472,11 @@ int main(int argc, char **argv)
// process halrmt command line args
while((opt = getopt_long(argc, argv, "e:n:p:s:w:", longopts, NULL)) != -1) {
switch(opt) {
case 'e': strncpy(enablePWD, optarg, strlen(optarg) + 1); break;
case 'n': strncpy(serverName, optarg, strlen(optarg) + 1); break;
case 'e': snprintf(enablePWD, sizeof(enablePWD), "%s", optarg); break;
case 'n': snprintf(serverName, sizeof(serverName), "%s", optarg); break;
case 'p': sscanf(optarg, "%d", &port); break;
case 's': sscanf(optarg, "%d", &maxSessions); break;
case 'w': strncpy(pwd, optarg, strlen(optarg) + 1); break;
case 'w': snprintf(pwd, sizeof(pwd), "%s", optarg); break;
}
}

Expand Down
11 changes: 3 additions & 8 deletions src/hal/utils/miscgtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,16 @@ void gtk_label_size_to_fit(GtkLabel * label, const gchar * str)
{
GtkRequisition req;
const gchar *current_text;
gint text_len;
gchar *text_buf;

/* get a pointer to the current text */
current_text = gtk_label_get_text(label);
/* how long is it */
text_len = strlen(current_text);
/* allocate memory to save it */
text_buf = malloc(text_len + 2);
/* make a temporary copy */
text_buf = strdup(current_text);
if (text_buf == NULL) {
printf("gtk_label_size_to_fit() - malloc failed\n");
printf("gtk_label_size_to_fit() - strdup failed\n");
return;
}
/* save the text */
strncpy(text_buf, current_text, text_len + 1);
/* set the label to display the new text */
gtk_label_set_text(label, str);
/* how big is the label with the new text? */
Expand Down
Loading