Index: src/CodeGen/CodeGenerator.cc
===================================================================
--- src/CodeGen/CodeGenerator.cc	(revision 4b2589a5585c447a4b3ff6c5524c919a032e22a4)
+++ src/CodeGen/CodeGenerator.cc	(revision 39f04ec7fc604e393bb1aac0ed3794cad214ad4d)
@@ -10,6 +10,6 @@
 // Created On       : Mon May 18 07:44:20 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Jun  9 13:21:00 2016
-// Update Count     : 256
+// Last Modified On : Mon Jul  4 20:38:32 2016
+// Update Count     : 300
 //
 
@@ -47,4 +47,16 @@
 			dynamic_cast< WhileStmt * >( stmt ) || dynamic_cast< ForStmt * > ( stmt ) || dynamic_cast< SwitchStmt *>( stmt );
 	}
+
+	void CodeGenerator::extension( Expression *expr ) {
+		if ( expr->get_extension() ) {
+			output << "__extension__ ";
+		} // if
+	} // extension
+
+	void CodeGenerator::extension( Declaration *decl ) {
+		if ( decl->get_extension() ) {
+			output << "__extension__ ";
+		} // if
+	} // extension
 
 	ostream & CodeGenerator::Indenter::operator()( ostream & output ) const {
@@ -110,4 +122,5 @@
 	//*** Declarations
 	void CodeGenerator::visit( FunctionDecl *functionDecl ) {
+		extension( functionDecl );
 		genAttributes( functionDecl->get_attributes() );
 
@@ -134,4 +147,5 @@
 
 	void CodeGenerator::visit( ObjectDecl *objectDecl ) {
+		extension( objectDecl );
 		handleStorageClass( objectDecl );
 		output << genType( objectDecl->get_type(), mangleName( objectDecl ) );
@@ -170,20 +184,23 @@
 
 	void CodeGenerator::visit( StructDecl *structDecl ) {
+		extension( structDecl );
 		output << "struct ";
 		handleAggregate( structDecl );
 	}
 
-	void CodeGenerator::visit( UnionDecl *aggregateDecl ) {
+	void CodeGenerator::visit( UnionDecl *unionDecl ) {
+		extension( unionDecl );
 		output << "union ";
-		handleAggregate( aggregateDecl );
-	}
-
-	void CodeGenerator::visit( EnumDecl *aggDecl ) {
+		handleAggregate( unionDecl );
+	}
+
+	void CodeGenerator::visit( EnumDecl *enumDecl ) {
+		extension( enumDecl );
 		output << "enum ";
 
-		if ( aggDecl->get_name() != "" )
-			output << aggDecl->get_name();
-
-		std::list< Declaration* > &memb = aggDecl->get_members();
+		if ( enumDecl->get_name() != "" )
+			output << enumDecl->get_name();
+
+		std::list< Declaration* > &memb = enumDecl->get_members();
 
 		if ( ! memb.empty() ) {
@@ -208,9 +225,10 @@
 	}
 
-	void CodeGenerator::visit( TraitDecl *aggregateDecl ) {}
+	void CodeGenerator::visit( TraitDecl *traitDecl ) {}
 
 	void CodeGenerator::visit( TypedefDecl *typeDecl ) {
-		output << "typedef ";
-		output << genType( typeDecl->get_base(), typeDecl->get_name() );
+		assert( false && "Typedefs are removed and substituted in earlier passes." );
+		//output << "typedef ";
+		//output << genType( typeDecl->get_base(), typeDecl->get_name() );
 	}
 
@@ -218,4 +236,5 @@
 		// really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes,
 		// still to be done
+		extension( typeDecl );
 		output << "extern unsigned long " << typeDecl->get_name();
 		if ( typeDecl->get_base() ) {
@@ -251,6 +270,5 @@
 		output << "{ ";
 		if ( init->begin_initializers() == init->end_initializers() ) {
-			// illegal to leave initializer list empty for scalar initializers,
-			// but always legal to have 0
+			// illegal to leave initializer list empty for scalar initializers, but always legal to have 0
 			output << "0";
 		} else {
@@ -317,6 +335,6 @@
 				  case OT_DTOR:
 					if ( applicationExpr->get_args().size() == 1 ) {
-						// the expression fed into a single parameter constructor or destructor
-						// may contain side effects, so must still output this expression
+						// the expression fed into a single parameter constructor or destructor may contain side
+						// effects, so must still output this expression
 						output << "(";
 						(*arg++)->accept( *this );
@@ -403,6 +421,6 @@
 				  case OT_DTOR:
 					if ( untypedExpr->get_args().size() == 1 ) {
-						// the expression fed into a single parameter constructor or destructor
-						// may contain side effects, so must still output this expression
+						// the expression fed into a single parameter constructor or destructor may contain side
+						// effects, so must still output this expression
 						output << "(";
 						(*arg++)->accept( *this );
@@ -500,6 +518,5 @@
 			output << ")";
 		} else {
-			// otherwise, the cast is to an lvalue type, so the cast
-			// should be dropped, since the result of a cast is
+			// otherwise, the cast is to an lvalue type, so the cast should be dropped, since the result of a cast is
 			// never an lvalue in C
 		}
@@ -546,6 +563,6 @@
 
 	void CodeGenerator::visit( AlignofExpr *alignofExpr ) {
+		// use GCC extension to avoid bumping std to C11
 		extension( alignofExpr );
-		// use GCC extension to avoid bumping std to C11
 		output << "__alignof__(";
 		if ( alignofExpr->get_isType() ) {
@@ -558,9 +575,8 @@
 
 	void CodeGenerator::visit( UntypedOffsetofExpr *offsetofExpr ) {
-		assert( false && "UntypedOffsetofExpr should not reach code generation" );
+		assert( false && "UntypedOffsetofExpr should not reach code generation." );
 	}
 
 	void CodeGenerator::visit( OffsetofExpr *offsetofExpr ) {
-		extension( offsetofExpr );
 		// use GCC builtin
 		output << "__builtin_offsetof(";
@@ -571,5 +587,5 @@
 
 	void CodeGenerator::visit( OffsetPackExpr *offsetPackExpr ) {
-		assert( false && "OffsetPackExpr should not reach code generation" );
+		assert( false && "OffsetPackExpr should not reach code generation." );
 	}
 
@@ -612,5 +628,4 @@
 
 	void CodeGenerator::visit( AsmExpr *asmExpr ) {
-		extension( asmExpr );
 		if ( asmExpr->get_inout() ) {
 			output << "[ ";
@@ -777,6 +792,5 @@
 
 	void CodeGenerator::visit( ForStmt *forStmt ) {
-		// initialization is always hoisted, so don't
-		// bother doing anything with that
+		// initialization is always hoisted, so don't bother doing anything with that
 		output << "for (;";
 
