Changes in / [7ecbb7e:5b7a60c8]
- Location:
- src
- Files:
-
- 1 added
- 7 edited
-
Common/Assert.cc (added)
-
Common/module.mk (modified) (1 diff)
-
Makefile.am (modified) (2 diffs)
-
Makefile.in (modified) (7 diffs)
-
Parser/DeclarationNode.cc (modified) (2 diffs)
-
Parser/ParseNode.cc (modified) (2 diffs)
-
Parser/ParseNode.h (modified) (3 diffs)
-
main.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/module.mk
r7ecbb7e r5b7a60c8 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Mon Jun 1 17:51:23 201514 ## Update Count : 113 ## Last Modified On : Thu Aug 18 13:29:04 2016 14 ## Update Count : 2 15 15 ############################################################################### 16 16 17 17 SRC += Common/SemanticError.cc \ 18 Common/UniqueName.cc 18 Common/UniqueName.cc \ 19 Common/Assert.cc -
src/Makefile.am
r7ecbb7e r5b7a60c8 11 11 ## Created On : Sun May 31 08:51:46 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Fri Jul 8 12:22:25201614 ## Update Count : 6 013 ## Last Modified On : Thu Aug 18 16:37:20 2016 14 ## Update Count : 68 15 15 ############################################################################### 16 16 … … 42 42 cfa_cpplib_PROGRAMS = driver/cfa-cpp 43 43 driver_cfa_cpp_SOURCES = ${SRC} 44 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap 45 # need files Common/utility.h 46 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL 47 48 AM_CXXFLAGS = -g -std=c++11 44 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap 45 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I@CFA_PREFIX@/src/include 49 46 50 47 MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}} -
src/Makefile.in
r7ecbb7e r5b7a60c8 105 105 Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \ 106 106 Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \ 107 Common/driver_cfa_cpp-Assert.$(OBJEXT) \ 107 108 ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \ 108 109 ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \ … … 369 370 CodeGen/CodeGenerator.cc CodeGen/GenType.cc \ 370 371 CodeGen/FixNames.cc CodeGen/OperatorTable.cc \ 371 Common/SemanticError.cc Common/UniqueName.cc \372 Common/SemanticError.cc Common/UniqueName.cc Common/Assert.cc \ 372 373 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 373 374 ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \ … … 425 426 cfa_cpplibdir = ${libdir} 426 427 driver_cfa_cpp_SOURCES = ${SRC} 427 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap428 driver_cfa_cpp_LDADD = ${LEXLIB} # yywrap 428 429 # need files Common/utility.h 429 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL 430 AM_CXXFLAGS = -g -std=c++11 430 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I@CFA_PREFIX@/src/include 431 431 all: $(BUILT_SOURCES) 432 432 $(MAKE) $(AM_MAKEFLAGS) all-am … … 527 527 Common/$(DEPDIR)/$(am__dirstamp) 528 528 Common/driver_cfa_cpp-UniqueName.$(OBJEXT): Common/$(am__dirstamp) \ 529 Common/$(DEPDIR)/$(am__dirstamp) 530 Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \ 529 531 Common/$(DEPDIR)/$(am__dirstamp) 530 532 ControlStruct/$(am__dirstamp): … … 814 816 -rm -f CodeGen/driver_cfa_cpp-Generate.$(OBJEXT) 815 817 -rm -f CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT) 818 -rm -f Common/driver_cfa_cpp-Assert.$(OBJEXT) 816 819 -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT) 817 820 -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT) … … 923 926 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Po@am__quote@ 924 927 @AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-OperatorTable.Po@am__quote@ 928 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po@am__quote@ 925 929 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@ 926 930 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@ … … 1164 1168 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-UniqueName.obj `if test -f 'Common/UniqueName.cc'; then $(CYGPATH_W) 'Common/UniqueName.cc'; else $(CYGPATH_W) '$(srcdir)/Common/UniqueName.cc'; fi` 1165 1169 1170 Common/driver_cfa_cpp-Assert.o: Common/Assert.cc 1171 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Assert.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo -c -o Common/driver_cfa_cpp-Assert.o `test -f 'Common/Assert.cc' || echo '$(srcdir)/'`Common/Assert.cc 1172 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po 1173 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Common/Assert.cc' object='Common/driver_cfa_cpp-Assert.o' libtool=no @AMDEPBACKSLASH@ 1174 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1175 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.o `test -f 'Common/Assert.cc' || echo '$(srcdir)/'`Common/Assert.cc 1176 1177 Common/driver_cfa_cpp-Assert.obj: Common/Assert.cc 1178 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-Assert.obj -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi` 1179 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) Common/$(DEPDIR)/driver_cfa_cpp-Assert.Tpo Common/$(DEPDIR)/driver_cfa_cpp-Assert.Po 1180 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='Common/Assert.cc' object='Common/driver_cfa_cpp-Assert.obj' libtool=no @AMDEPBACKSLASH@ 1181 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1182 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Common/driver_cfa_cpp-Assert.obj `if test -f 'Common/Assert.cc'; then $(CYGPATH_W) 'Common/Assert.cc'; else $(CYGPATH_W) '$(srcdir)/Common/Assert.cc'; fi` 1183 1166 1184 ControlStruct/driver_cfa_cpp-LabelGenerator.o: ControlStruct/LabelGenerator.cc 1167 1185 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelGenerator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelGenerator.o `test -f 'ControlStruct/LabelGenerator.cc' || echo '$(srcdir)/'`ControlStruct/LabelGenerator.cc -
src/Parser/DeclarationNode.cc
r7ecbb7e r5b7a60c8 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 11:08:56201613 // Update Count : 18 012 // Last Modified On : Wed Aug 17 23:14:51 2016 13 // Update Count : 181 14 14 // 15 15 … … 779 779 } 780 780 781 DeclarationNode *DeclarationNode::appendList( DeclarationNode *node ) {782 return (DeclarationNode *)set_last( node );783 }784 785 781 DeclarationNode *DeclarationNode::extractAggregate() const { 786 782 if ( type ) { -
src/Parser/ParseNode.cc
r7ecbb7e r5b7a60c8 10 10 // Created On : Sat May 16 13:26:29 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21:31:47201613 // Update Count : 12 512 // Last Modified On : Wed Aug 17 23:14:16 2016 13 // Update Count : 126 14 14 // 15 15 … … 19 19 int ParseNode::indent_by = 4; 20 20 21 ParseNode::ParseNode() {};22 ParseNode::ParseNode( const string *name ) : name( *name ) { assert( false ); delete name; }23 ParseNode::ParseNode( const string &name ) : name( name ) { assert( false ); }24 25 ParseNode::~ParseNode() {26 delete next;27 };28 29 ParseNode *ParseNode::get_last() {30 ParseNode *current;31 for ( current = this; current->get_next() != 0; current = current->get_next() );32 return current;33 }34 35 ParseNode *ParseNode::set_last( ParseNode *newlast ) {36 if ( newlast != 0 ) get_last()->set_next( newlast );37 return this;38 }39 40 21 // Local Variables: // 41 22 // tab-width: 4 // -
src/Parser/ParseNode.h
r7ecbb7e r5b7a60c8 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21:32:18201613 // Update Count : 5 3812 // Last Modified On : Wed Aug 17 23:15:59 2016 13 // Update Count : 541 14 14 // 15 15 … … 40 40 class ParseNode { 41 41 public: 42 ParseNode() ;43 ParseNode( const std::string * );44 ParseNode( const std::string & ); // for copy constructing subclasses45 virtual ~ParseNode() ;42 ParseNode() {}; 43 ParseNode( const std::string *name ) : name( *name ) { assert( false ); delete name; } 44 ParseNode( const std::string &name ) : name( name ) { assert( false ); } 45 virtual ~ParseNode() { delete next; }; 46 46 virtual ParseNode *clone() const = 0; 47 47 48 48 ParseNode *get_next() const { return next; } 49 49 ParseNode *set_next( ParseNode *newlink ) { next = newlink; return this; } 50 ParseNode *get_last(); 51 ParseNode *set_last( ParseNode *newlast ); 50 ParseNode *get_last() { 51 ParseNode *current; 52 for ( current = this; current->get_next() != 0; current = current->get_next() ); 53 return current; 54 } 55 ParseNode *set_last( ParseNode *newlast ) { 56 if ( newlast != 0 ) get_last()->set_next( newlast ); 57 return this; 58 } 52 59 53 60 const std::string &get_name() const { return name; } … … 254 261 DeclarationNode *cloneBaseType( DeclarationNode *newdecl ); 255 262 256 DeclarationNode *appendList( DeclarationNode * ); 263 DeclarationNode *appendList( DeclarationNode *node ) { 264 return (DeclarationNode *)set_last( node ); 265 } 257 266 258 267 void print( std::ostream &os, int indent = 0 ) const; -
src/main.cc
r7ecbb7e r5b7a60c8 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 22:13:38201613 // Update Count : 34 112 // Last Modified On : Thu Aug 18 16:33:49 2016 13 // Update Count : 347 14 14 // 15 15 … … 70 70 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout ); 71 71 72 //************************************************73 74 #define __STRINGIFY__(str) #str75 #define __VSTRINGIFY__(str) __STRINGIFY__(str)76 #define assertf(expr, fmt, ...) ((expr) ? static_cast<void>(0) : __assert_fail_f(__VSTRINGIFY__(expr), __FILE__, __LINE__, __PRETTY_FUNCTION__, fmt, ## __VA_ARGS__ ))77 #define CFA_ASSERT_FMT "*CFA assertion error* from program \"%s\" in \"%s\" at line %d in file \"%s\": "78 79 extern const char * __progname; // global name of running executable (argv[0])80 // called by macro assert in assert.h81 void __assert_fail( const char *assertion, const char *file, unsigned int line, const char *function ) {82 fprintf( stderr, CFA_ASSERT_FMT, __progname, function, line, file );83 exit( EXIT_FAILURE );84 }85 86 #include <cstdarg>87 // called by macro assertf88 void __assert_fail_f( const char *assertion, const char *file, unsigned int line, const char *function, const char *fmt, ... ) {89 fprintf( stderr, CFA_ASSERT_FMT, __progname, function, line, file );90 va_list args;91 va_start( args, fmt );92 vfprintf( stderr, fmt, args );93 exit( EXIT_FAILURE );94 }95 96 //************************************************97 98 72 int main( int argc, char * argv[] ) { 99 73 FILE * input; // use FILE rather than istream because yyin is FILE … … 408 382 } // dump 409 383 410 411 412 384 // Local Variables: // 413 385 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.