Changeset 1cb2282


Ignore:
Timestamp:
Aug 18, 2016, 4:59:11 PM (6 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
99cad3aa
Parents:
3b8e52c
Message:

add new assert macro for printing message

Location:
src
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/module.mk

    r3b8e52c r1cb2282  
    1111## Created On       : Mon Jun  1 17:49:17 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Jun  1 17:51:23 2015
    14 ## Update Count     : 1
     13## Last Modified On : Thu Aug 18 13:29:04 2016
     14## Update Count     : 2
    1515###############################################################################
    1616
    1717SRC += Common/SemanticError.cc \
    18        Common/UniqueName.cc
     18       Common/UniqueName.cc \
     19       Common/Assert.cc
  • src/Makefile.am

    r3b8e52c r1cb2282  
    1111## Created On       : Sun May 31 08:51:46 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Fri Jul  8 12:22:25 2016
    14 ## Update Count     : 60
     13## Last Modified On : Thu Aug 18 16:37:20 2016
     14## Update Count     : 68
    1515###############################################################################
    1616
     
    4242cfa_cpplib_PROGRAMS = driver/cfa-cpp
    4343driver_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
     44driver_cfa_cpp_LDADD = ${LEXLIB}                        # yywrap
     45driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I@CFA_PREFIX@/src/include
    4946
    5047MAINTAINERCLEANFILES += ${libdir}/${notdir ${cfa_cpplib_PROGRAMS}}
  • src/Makefile.in

    r3b8e52c r1cb2282  
    105105        Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \
    106106        Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \
     107        Common/driver_cfa_cpp-Assert.$(OBJEXT) \
    107108        ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT) \
    108109        ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \
     
    369370        CodeGen/CodeGenerator.cc CodeGen/GenType.cc \
    370371        CodeGen/FixNames.cc CodeGen/OperatorTable.cc \
    371         Common/SemanticError.cc Common/UniqueName.cc \
     372        Common/SemanticError.cc Common/UniqueName.cc Common/Assert.cc \
    372373        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    373374        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
     
    425426cfa_cpplibdir = ${libdir}
    426427driver_cfa_cpp_SOURCES = ${SRC}
    427 driver_cfa_cpp_LDADD = ${LEXLIB}        # yywrap
     428driver_cfa_cpp_LDADD = ${LEXLIB}                        # yywrap
    428429# need files Common/utility.h
    429 driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL
    430 AM_CXXFLAGS = -g -std=c++11
     430driver_cfa_cpp_CXXFLAGS = -Wno-deprecated -Wall -DDEBUG_ALL -I@CFA_PREFIX@/src/include
    431431all: $(BUILT_SOURCES)
    432432        $(MAKE) $(AM_MAKEFLAGS) all-am
     
    527527        Common/$(DEPDIR)/$(am__dirstamp)
    528528Common/driver_cfa_cpp-UniqueName.$(OBJEXT): Common/$(am__dirstamp) \
     529        Common/$(DEPDIR)/$(am__dirstamp)
     530Common/driver_cfa_cpp-Assert.$(OBJEXT): Common/$(am__dirstamp) \
    529531        Common/$(DEPDIR)/$(am__dirstamp)
    530532ControlStruct/$(am__dirstamp):
     
    814816        -rm -f CodeGen/driver_cfa_cpp-Generate.$(OBJEXT)
    815817        -rm -f CodeGen/driver_cfa_cpp-OperatorTable.$(OBJEXT)
     818        -rm -f Common/driver_cfa_cpp-Assert.$(OBJEXT)
    816819        -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT)
    817820        -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
     
    923926@AMDEP_TRUE@@am__include@ @am__quote@CodeGen/$(DEPDIR)/driver_cfa_cpp-Generate.Po@am__quote@
    924927@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@
    925929@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@
    926930@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
     
    11641168@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`
    11651169
     1170Common/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
     1177Common/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
    11661184ControlStruct/driver_cfa_cpp-LabelGenerator.o: ControlStruct/LabelGenerator.cc
    11671185@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/main.cc

    r3b8e52c r1cb2282  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug 17 22:13:38 2016
    13 // Update Count     : 341
     12// Last Modified On : Thu Aug 18 16:33:49 2016
     13// Update Count     : 347
    1414//
    1515
     
    7070static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout );
    7171
    72 //************************************************
    73 
    74 #define __STRINGIFY__(str) #str
    75 #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.h
    81 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 assertf
    88 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 
    9872int main( int argc, char * argv[] ) {
    9973        FILE * input;                                                                           // use FILE rather than istream because yyin is FILE
     
    408382} // dump
    409383
    410 
    411 
    412384// Local Variables: //
    413385// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.