Changeset 926af74
- Timestamp:
- Aug 17, 2016, 9:31:28 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, 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, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 3b8e52c, 6643e72
- Parents:
- 5ead9f9
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TypeData.cc
r5ead9f9 r926af74 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 15 20:48:52201613 // Update Count : 6 212 // Last Modified On : Wed Aug 17 08:47:48 2016 13 // Update Count : 63 14 14 // 15 15 … … 908 908 buildList( enumeration->constants, ret->get_members() ); 909 909 std::list< Declaration * >::iterator members = ret->get_members().begin(); 910 for ( const DeclarationNode *cur = enumeration->constants; cur != NULL; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) {911 if ( cur->get_enumeratorValue() != NULL) {910 for ( const DeclarationNode *cur = enumeration->constants; cur != nullptr; cur = dynamic_cast< DeclarationNode * >( cur->get_next() ), ++members ) { 911 if ( cur->get_enumeratorValue() != nullptr ) { 912 912 ObjectDecl *member = dynamic_cast< ObjectDecl * >(*members); 913 913 member->set_init( new SingleInit( maybeBuild< Expression >( cur->get_enumeratorValue() ), std::list< Expression * >() ) ); -
src/Parser/lex.cc
r5ead9f9 r926af74 1468 1468 * Author : Peter A. Buhr 1469 1469 * Created On : Sat Sep 22 08:58:10 2001 1470 * Last Modified By : 1471 * Last Modified On : Sun Jul 31 07:19:3620161472 * Update Count : 4 591470 * Last Modified By : Peter A. Buhr 1471 * Last Modified On : Tue Aug 16 22:34:31 2016 1472 * Update Count : 460 1473 1473 */ 1474 1474 #line 20 "lex.ll" … … 1491 1491 #define RETURN_LOCN(x) yylval.tok.loc.file = yyfilename; yylval.tok.loc.line = yylineno; return( x ) 1492 1492 #define RETURN_VAL(x) yylval.tok.str = new std::string( yytext ); RETURN_LOCN( x ) 1493 #define RETURN_CHAR(x) yylval.tok.str = NULL; RETURN_LOCN( x )1493 #define RETURN_CHAR(x) yylval.tok.str = nullptr; RETURN_LOCN( x ) 1494 1494 #define RETURN_STR(x) yylval.tok.str = strtext; RETURN_LOCN( x ) 1495 1495 -
src/Parser/lex.ll
r5ead9f9 r926af74 9 9 * Author : Peter A. Buhr 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 * Last Modified By : 12 * Last Modified On : Sun Jul 31 07:19:36201613 * Update Count : 4 5911 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue Aug 16 22:34:31 2016 13 * Update Count : 460 14 14 */ 15 15 … … 36 36 #define RETURN_LOCN(x) yylval.tok.loc.file = yyfilename; yylval.tok.loc.line = yylineno; return( x ) 37 37 #define RETURN_VAL(x) yylval.tok.str = new std::string( yytext ); RETURN_LOCN( x ) 38 #define RETURN_CHAR(x) yylval.tok.str = NULL; RETURN_LOCN( x )38 #define RETURN_CHAR(x) yylval.tok.str = nullptr; RETURN_LOCN( x ) 39 39 #define RETURN_STR(x) yylval.tok.str = strtext; RETURN_LOCN( x ) 40 40 -
src/Parser/parser.cc
r5ead9f9 r926af74 5709 5709 #line 700 "parser.yy" 5710 5710 { // mark all fields in list 5711 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_next() )5711 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 5712 5712 iter->set_extension( true ); 5713 5713 (yyval.sn) = new StatementNode( (yyvsp[(2) - (2)].decl) ); … … 7047 7047 #line 1494 "parser.yy" 7048 7048 { // mark all fields in list 7049 for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_next() )7049 for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 7050 7050 iter->set_extension( true ); 7051 7051 (yyval.decl) = (yyvsp[(2) - (3)].decl); … … 7772 7772 /* Line 1806 of yacc.c */ 7773 7773 #line 1972 "parser.yy" 7774 { parseTree = parseTree ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl); }7774 { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl); } 7775 7775 break; 7776 7776 … … 7779 7779 /* Line 1806 of yacc.c */ 7780 7780 #line 1978 "parser.yy" 7781 { (yyval.decl) = ( (yyvsp[(1) - (3)].decl) != NULL )? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }7781 { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); } 7782 7782 break; 7783 7783 … … 7822 7822 #line 2004 "parser.yy" 7823 7823 { // mark all fields in list 7824 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_next() )7824 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 7825 7825 iter->set_extension( true ); 7826 7826 (yyval.decl) = (yyvsp[(2) - (2)].decl); -
src/Parser/parser.yy
r5ead9f9 r926af74 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21: 31:46201613 // Update Count : 190 612 // Last Modified On : Tue Aug 16 21:59:35 2016 13 // Update Count : 1907 14 14 // 15 15 … … 699 699 | EXTENSION declaration // GCC 700 700 { // mark all fields in list 701 for ( DeclarationNode *iter = $2; iter != NULL; iter = (DeclarationNode *)iter->get_next() )701 for ( DeclarationNode *iter = $2; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 702 702 iter->set_extension( true ); 703 703 $$ = new StatementNode( $2 ); … … 1493 1493 | EXTENSION field_declaring_list ';' // GCC 1494 1494 { // mark all fields in list 1495 for ( DeclarationNode *iter = $2; iter != NULL; iter = (DeclarationNode *)iter->get_next() )1495 for ( DeclarationNode *iter = $2; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 1496 1496 iter->set_extension( true ); 1497 1497 $$ = $2; … … 1970 1970 {} // empty input file 1971 1971 | external_definition_list 1972 { parseTree = parseTree ? parseTree->appendList( $1 ) : $1; }1972 { parseTree = parseTree != nullptr ? parseTree->appendList( $1 ) : $1; } 1973 1973 ; 1974 1974 … … 1976 1976 external_definition 1977 1977 | external_definition_list push external_definition 1978 { $$ = ( $1 != NULL )? $1->appendList( $3 ) : $3; }1978 { $$ = $1 != nullptr ? $1->appendList( $3 ) : $3; } 1979 1979 ; 1980 1980 … … 2003 2003 | EXTENSION external_definition 2004 2004 { // mark all fields in list 2005 for ( DeclarationNode *iter = $2; iter != NULL; iter = (DeclarationNode *)iter->get_next() )2005 for ( DeclarationNode *iter = $2; iter != nullptr; iter = (DeclarationNode *)iter->get_next() ) 2006 2006 iter->set_extension( true ); 2007 2007 $$ = $2; -
src/main.cc
r5ead9f9 r926af74 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 16 21:33:49201613 // Update Count : 2 6012 // Last Modified On : Wed Aug 17 09:08:43 2016 13 // Update Count : 274 14 14 // 15 15 … … 20 20 #include "Parser/parser.h" 21 21 #include "Parser/TypedefTable.h" 22 #include "SynTree/Declaration.h"23 #include "SynTree/Visitor.h"24 22 #include "GenPoly/Lvalue.h" 25 23 #include "GenPoly/Specialize.h" … … 30 28 #include "CodeGen/FixNames.h" 31 29 #include "ControlStruct/Mutate.h" 32 #include "Tuples/Mutate.h"33 #include "Tuples/FunctionChecker.h"34 #include "SymTab/Mangler.h"35 #include "SymTab/Indexer.h"36 30 #include "SymTab/Validate.h" 37 31 #include "ResolvExpr/AlternativePrinter.h" 38 32 #include "ResolvExpr/Resolver.h" 39 33 #include "MakeLibCfa.h" 40 #include "InitTweak/Mutate.h"41 34 #include "InitTweak/GenInit.h" 42 35 #include "InitTweak/FixInit.h" 43 44 #include "Common/SemanticError.h"45 36 #include "Common/UnimplementedError.h" 46 37 … … 51 42 #define OPTPRINT(x) if ( errorp ) std::cerr << x << std::endl; 52 43 53 extern int yydebug;54 44 55 45 LinkageSpec::Type linkage = LinkageSpec::Cforall; … … 57 47 DeclarationNode * parseTree = nullptr; // program parse tree 58 48 49 extern int yydebug; // set for -g flag (Grammar) 59 50 bool 60 51 astp = false, … … 64 55 exprp = false, 65 56 expraltp = false, 66 grammarp = false,67 57 libcfap = false, 68 58 nopreludep = false, … … 76 66 codegenp = false; 77 67 68 static void parse_cmdline( int argc, char *argv[], const char *& filename ); 78 69 static void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false ); 79 70 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out = std::cout ); 80 static void parse_cmdline( int argc, char *argv[], const char *& filename );81 71 82 72 … … 85 75 std::ostream *output = & std::cout; 86 76 std::list< Declaration * > translationUnit; 87 const char *filename = NULL;77 const char *filename = nullptr; 88 78 89 79 parse_cmdline( argc, argv, filename ); // process command-line arguments … … 98 88 } // if 99 89 // if running cfa-cpp directly, might forget to pass -F option (and really shouldn't have to) 100 if ( filename == NULL) filename = argv[ optind ];90 if ( filename == nullptr ) filename = argv[ optind ]; 101 91 // prelude filename comes in differently 102 92 if ( libcfap ) filename = "prelude.cf"; … … 106 96 // if running cfa-cpp directly, might forget to pass -F option. Since this takes from stdin, pass 107 97 // a fake name along 108 if ( filename == NULL) filename = "stdin";98 if ( filename == nullptr ) filename = "stdin"; 109 99 } // if 110 100 … … 112 102 output = new ofstream( argv[ optind ] ); 113 103 } // if 114 115 yydebug = grammarp;116 104 117 105 // read in the builtins, extras, and the prelude … … 119 107 // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here. 120 108 FILE * builtins = fopen( libcfap | treep ? "builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" ); 121 if ( builtins == NULL) {109 if ( builtins == nullptr ) { 122 110 std::cerr << "Error: cannot open builtins.cf" << std::endl; 123 111 exit( EXIT_FAILURE ); … … 127 115 // read the extra prelude in, if not generating the cfa library 128 116 FILE * extras = fopen( libcfap | treep ? "extras.cf" : CFA_LIBDIR "/extras.cf", "r" ); 129 if ( extras == NULL) {117 if ( extras == nullptr ) { 130 118 std::cerr << "Error: cannot open extras.cf" << std::endl; 131 119 exit( EXIT_FAILURE ); … … 136 124 // read the prelude in, if not generating the cfa library 137 125 FILE * prelude = fopen( treep ? "prelude.cf" : CFA_LIBDIR "/prelude.cf", "r" ); 138 if ( prelude == NULL) {126 if ( prelude == nullptr ) { 139 127 std::cerr << "Error: cannot open prelude.cf" << std::endl; 140 128 exit( EXIT_FAILURE ); … … 145 133 } // if 146 134 147 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp);135 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, yydebug ); 148 136 149 137 if ( parsep ) { … … 202 190 dump( translationUnit ); 203 191 return 0; 204 } 192 } // if 205 193 206 194 // fix ObjectDecl - replaces ConstructorInit nodes … … 210 198 dump ( translationUnit ); 211 199 return 0; 212 } 200 } // if 213 201 214 202 OPTPRINT("instantiateGenerics") … … 224 212 dump( translationUnit ); 225 213 return 0; 226 } 214 } // if 227 215 OPTPRINT( "box" ) 228 216 GenPoly::box( translationUnit ); … … 244 232 dump( translationUnit, std::cerr ); 245 233 std::cerr << std::endl << "---End of AST, begin error message:---\n" << std::endl; 246 } 234 } // if 247 235 e.print( std::cerr ); 248 236 if ( output != &std::cout ) { … … 322 310 case Grammar: 323 311 case 'g': // bison debugging info (grammar rules) 324 grammarp= true;312 yydebug = true; 325 313 break; 326 314 case LibCFA: … … 398 386 static void dump( std::list< Declaration * > & translationUnit, std::ostream & out ) { 399 387 std::list< Declaration * > decls; 388 400 389 if ( noprotop ) { 401 390 filter( translationUnit.begin(), translationUnit.end(), std::back_inserter( decls ), notPrelude ); 402 391 } else { 403 392 decls = translationUnit; 404 } 393 } // if 405 394 406 395 printAll( decls, out ); -
src/tests/.expect/64/gccExtensions.txt
r5ead9f9 r926af74 11 11 asm ( "nop" : : : ); 12 12 static int __y__i_2; 13 static int *__z__Pi_2; 13 14 int __src__i_2; 14 15 int __dst__i_2; … … 23 24 const int __i2__Ci_2; 24 25 const int __i3__Ci_2; 26 inline int __f1__Fi___2(){ 27 } 28 inline int __f2__Fi___2(){ 29 } 30 int __s1__i_2; 31 int __s2__i_2; 32 volatile int __v1__Vi_2; 33 volatile int __v2__Vi_2; 34 int __t1___2; 35 int __t2___2; 25 36 __extension__ const int __ex__Ci_2; 26 37 struct S { … … 73 84 ((void)(__extension__ __a__i_2=(__extension__ __b__i_2+__extension__ __c__i_2))); 74 85 ((void)(__extension__ __a__i_2=__extension__ (__extension__ __b__i_2+__extension__ __c__i_2))); 75 inline int __f1__Fi___2(){76 }77 inline int __f2__Fi___2(){78 }79 int __s1__i_2;80 int __s2__i_2;81 int __t1___2;82 int __t2___2;83 volatile int __v1__Vi_2;84 volatile int __v2__Vi_2;85 86 int __a1__i_2; 86 87 const int __a2__Ci_2; -
src/tests/gccExtensions.c
r5ead9f9 r926af74 10 10 // Created On : Sun Aug 14 17:28:17 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 17 0 8:34:57201613 // Update Count : 712 // Last Modified On : Wed Aug 17 09:26:50 2016 13 // Update Count : 10 14 14 // 15 15 … … 17 17 18 18 int main(int argc, char const *argv[]) { 19 // asm extensions 20 19 21 asm( "nop" ); 20 22 __asm( "nop" ); … … 54 56 : L1, L2 ); 55 57 58 // alternative type/qualifer names 59 56 60 __complex__ c1; 57 61 _Complex c2; … … 60 64 __const int i2; 61 65 __const__ int i3; 66 67 __inline int f1() {} 68 __inline__ int f2() {} 69 70 __signed s1; 71 __signed s2; 72 73 __volatile int v1; 74 __volatile__ int v2; 75 76 // symbol table attributes 77 78 __typeof(s1) t1; 79 __typeof__(s1) t2; 80 81 // strange extension qualifier 62 82 63 83 __extension__ const int ex; … … 71 91 __extension__ a = __extension__ ( __extension__ b + __extension__ c ); 72 92 73 __inline int f1() {} 74 __inline__ int f2() {} 75 76 __signed s1; 77 __signed s2; 78 79 __typeof(s1) t1; 80 __typeof__(s1) t2; 81 82 __volatile int v1; 83 __volatile__ int v2; 93 // attributes 84 94 85 95 __attribute__(()) int a1;
Note: See TracChangeset
for help on using the changeset viewer.