Commit graph

1488 commits

Author SHA1 Message Date
Jeff Epler
02910b2d38 Match new[] and delete[]
.. this would otherwise cause a memory use error in the unusual case
where a numeric identifer held more letters than expected.

For instance, passing the following file as the input to tst_inverse_attr3:

ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('SCL test file'),'2;1');
FILE_NAME('test_inverse_attr.p21','2012-06-30T',('mp'),(''),'0','1','2');
FILE_SCHEMA(('test_inverse_attr'));
ENDSEC;
DATA;
ENDSEC;
END-ISO-10303-21;

and running it under valgrind can cause a diagnostic similar to the following to be displayed:
Mismatched free() / delete / delete []
   at 0x4C2D2DB: operator delete(void*) (vg_replace_malloc.c:576)
   by 0x507A5A6: sectionReader::readInstanceNumber() (sectionReader.cc:224)
   by 0x507CCC7: lazyP21DataSectionReader::nextInstance() (lazyP21DataSectionReader.cc:53)
   by 0x507C797: lazyP21DataSectionReader::lazyP21DataSectionReader(lazyFileReader*, std::basic_ifstream<char, std::char_traits<char> >&, std::fpos<__mbstate_t>, unsigned short) (lazyP21DataSectionReader.cc:11)
   by 0x50699F2: lazyFileReader::initP21() (lazyFileReader.cc:14)
   by 0x5069E5D: lazyFileReader::lazyFileReader(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, lazyInstMgr*, unsigned short) (lazyFileReader.cc:61)
] and delete[]
   by 0x506AAA7: lazyInstMgr::openFile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (lazyInstMgr.cc:103)
   by 0x4023A1: main (inverse_attr3.cc:35)
 Address 0x6a861a0 is 0 bytes inside a block of size 21 alloc'd
   at 0x4C2C93F: operator new[](unsigned long) (vg_replace_malloc.c:423)
   by 0x507A3A7: sectionReader::readInstanceNumber() (sectionReader.cc:202)

This problem is also reported in static analysis by clang, and as such can be seen in travis ci build logs.
2017-08-15 21:24:23 -05:00
Mark
a96336ab97 Merge pull request #351 from stepcode/review/327
Review/327
2017-08-13 20:46:34 -04:00
Kunda
15afe96d67 Fixed typos showing up as ascii chars
Using http://www.lisi.ensma.fr/ftp/enseignement/A3_Master_Ingenierie_donnees/fonctionsGrammaire_EXPRESS.pdf I was able to fix typos in the text files for Builtin.py
2017-03-04 07:22:46 -05:00
Cliff Yapp
8627627c5e Add an option to completely bypass the git management of the version header. 2016-08-06 13:53:12 -04:00
Cliff Yapp
a243b4d8c8 Separate shared and static generated files for better parallel building safety. 2016-08-06 11:55:38 -04:00
Cliff Yapp
daec3e2640 Add option handling to the SC target macros, replacing the EXCLUDE_FROM_INSTALL macro. 2016-08-06 11:43:59 -04:00
Cliff Yapp
06b13bb9af Make a stab at adapting the new, simplier verification to vanilla stepcode 2016-08-06 11:23:34 -04:00
Mark Pictor
a160cc9af6 fix #327 - statically initialize t_sdaiINTEGER etc 2015-08-30 11:57:58 -04:00
Mark Pictor
677261d4fb fix LNK2004 getEDesc already defined in sectionReader.obj
is this really the only/best way to fix this?!
2015-08-09 23:36:54 -04:00
Mark Pictor
4207a46f07 fix MSVC link error for NilSTEPentity 2015-08-09 23:30:13 -04:00
Mark Pictor
7316fe5070 msvc warnings/errors 2015-08-09 23:29:15 -04:00
Mark Pictor
4d32009592 'register' storage class specifier is deprecated [-Wdeprecated-register] 2015-08-03 22:00:22 -04:00
Mark Pictor
0b6078b72b missing include 2015-08-03 21:55:00 -04:00
Mark Pictor
36e34862cc cllazyfile: work around LNK2005 error. had to tweak class members so MSVC didn't see MgrNodeBase class twice.
suspect there is a better solution, but I'm not sure what it would be
2015-08-03 21:50:19 -04:00
Mark Pictor
9dcb6aa640 build judy array as part of base lib, else import/export macros don't work 2015-08-03 21:38:37 -04:00
Mark Pictor
bc5533bda8 test for, and use, nullptr if we have it 2015-08-03 21:37:28 -04:00
Mark Pictor
b890c156f5 attempt to silence msvc linker errors 2015-08-02 22:50:26 -04:00
Mark Pictor
f2247d222f use COMPILE_DEFINITIONS property for definitions 2015-08-02 15:58:04 -04:00
Mark Pictor
5288026043 add windows dll import/export macros to cllazyfile 2015-08-02 15:57:10 -04:00
Mark Pictor
46c37207da replace c++ style comments recently introduced with c-style comments 2015-07-26 16:59:42 -04:00
Mark Pictor
ecde882d5a oops, forgot export macro for path2str 2015-07-26 14:32:43 -04:00
Mark Pictor
3d90ffdf83 remove yet more CORBA and ObjectStore stuff... surprised it still exists 2015-07-26 14:22:07 -04:00
Mark Pictor
5dfca2ed78 exp2py - remove unused function USEREFout 2015-07-26 14:20:24 -04:00
Mark Pictor
fbf0272d3b indent a listdo/listod 2015-07-26 13:42:52 -04:00
Mark Pictor
c69f9ebab2 fix length check for keyword detection function 2015-07-26 13:42:25 -04:00
Mark Pictor
942fb89f68 cleanup 2015-07-26 13:41:49 -04:00
Mark Pictor
893936b11f printf(...) -> fprintf( stderr, ...): warnings and errors should not be on stdout 2015-07-26 13:39:40 -04:00
Mark Pictor
e4a8be26da resolve MSVC "unknown escape sequence" warning 2015-07-19 18:29:55 -04:00
Christopher Horler
915e0de65f simplification - invocation of t_STRING / t_BINARY guarantees we can use string slicing rather than strip() 2015-07-08 07:59:37 +01:00
Christopher Horler
9c83ba32a9 fix list / params handling 2015-07-07 18:46:19 +01:00
Christopher Horler
13f36c11a8 implement value conversions for simple types 2015-07-07 18:44:58 +01:00
Christopher Horler
6b26410d9d make default implementation take bigger "slurps" looking for PART21_START tokens 2015-07-06 23:55:16 +01:00
Christopher Horler
3e84677ac9 change handling of base_tokens to simplify subclass implementations 2015-07-06 23:52:27 +01:00
Christopher Horler
081cf35855 Update tests function to parse every .stp file in the stepcode tree
(assumes code is under ~/projects/src/stepcode)
2015-07-05 18:36:33 +01:00
Christopher Horler
c1c3bc1077 Lexer improvements
- change way states are used, could give a substantial performance improvement
 - implement a more flexible approach for exchange_file start token search (more extensibile for subclassing)
 - rework/standardise keyword implementation for DATA token

Parser improvements
 - implement error handling for duplicate entity instances
   * parser catches the error, logs it
   * resyncs and continues (the duplicate is ignored)
 - rework the exchange_file structure detection
   * added parser.reset() to allow a more flexible approach to subclassing
2015-07-05 18:27:46 +01:00
Christopher Horler
6351ff38d9 Python 2.6
- replace another dict comprehension
 - ensure new style classes are used in Python 2.6
 - change the way the tokens list is used (improves ability to subclass)
2015-07-05 18:08:33 +01:00
Christopher Horler
a82f7497a6 Python 2.6 doesn't have NullHandler or dict comprehensions 2015-07-05 17:30:40 +01:00
Christopher Horler
eaf9ffc3f3 raise ValueError instead of sys.exit if input doesn't have valid header / or duplicate entity instances 2015-06-24 22:26:34 +01:00
Christopher Horler
b72f4d404a fix typo in rule 2015-06-24 17:59:01 +01:00
Christopher Horler
b31d8ef853 when subclassing due to ply's dir() usage to determine rules a start rule is necessary 2015-06-24 17:24:23 +01:00
Christopher Horler
c865023114 files may contain multiple exchange structures, to allow for this add rudimentary state tracking 2015-06-24 17:22:49 +01:00
Christopher Horler
25ca2a788d make Python Part21 lexer more extensible for writing custom parser rules 2015-06-22 20:38:20 +01:00
Mark Pictor
97731f8611 warning about extra parens 2015-06-13 21:13:04 -04:00
Christopher Horler
e8afb772f1 remove strncpy as we're not using it anyway - fixes crash on enumeration output 2015-06-13 15:35:32 +01:00
Mark Pictor
0eefd769e3 oops, use our own stdbool 2015-06-08 22:53:45 -04:00
Mark Pictor
1c8225f79a eliminate gcc warnings for exp2py 2015-06-08 22:40:38 -04:00
Mark Pictor
2d8a7373fd fix some MSVC warnings 2015-06-08 22:40:38 -04:00
Mark Pictor
2300021416 MSVC warning - multiple default constructors 2015-06-08 22:40:38 -04:00
Mark Pictor
91a2dcacf3 MSVC lacks __func__, use __FUNCTION__ instead 2015-06-08 22:40:38 -04:00
Mark Pictor
4129d363b0 add stepcore test for segfault in STEPattribute::set_null() 2015-05-20 20:51:14 -04:00