[#1111] Issue DUPLICATENEW warning if a variable is specified more than once in a NEW command

overview

This mr implements a mumps compile time warning whenever the user attempts to new the same variable multiple times in a single command. For example

NEW count1, count1, count2, count3, count4

This line would now produce a warning at compile time. Note that there is no functional difference between the above line and the line below.

NEW count1, count2, count3, count4

coding detail

The changes are mostly in m_new.c where the warning is issued. Other files were changed to add the new error into the error system. (sr_port/libydberrors2.h, sr_port/mdb_condition_handler.c, sr_port/ydberrors.h sr_port/ydberrors.msg, sr_port/ydberrors_ctl.c)

The function duplicatenew_check is called once per variable being newed and returns TRUE if it encounters a repeat. This function does allocate space to store the variables passed to it in a hashtable and cleans this space up at the end of the command, so the function duplicatenew_cleanup was created that can be used to clean up this space externally if necessary(if for example, the compiler exits with an error in the middle of a command). The header file sr_port/duplicatenew_cleanup.h was created to give this function a function declaration. If duplicate_new does not need a cleanup, it is still safe to call duplicatenew_cleanup.

sr_unix/ydbenv.mpt

Removed the 2nd $test from a new command in this mumps file as it is not intended to be there and the file should not produce a warning.

new $test,envsav,envval,$test
Changed to 
new $test,envsav,envval

sr_port/cmd.c

Just fixed a non-standard spacing error.

Edited by Ben Chermside

Merge request reports

Loading