Index: src/driver/cc1.cc
===================================================================
--- src/driver/cc1.cc	(revision 26ef3b2397369bc3bef6e6a70bd6a0d03d84bbd3)
+++ src/driver/cc1.cc	(revision dffaeac743b46e961ffdca195bffbf80bff2d6ad)
@@ -10,6 +10,6 @@
 // Created On       : Fri Aug 26 14:23:51 2005
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Sat May 12 16:11:53 2018
-// Update Count     : 94
+// Last Modified On : Fri Jul 13 17:40:10 2018
+// Update Count     : 110
 //
 
@@ -44,4 +44,19 @@
 } // prefix
 
+enum { NumSuffixes = 2 };
+const string suffixes[NumSuffixes] = { "cfa", "hfa", };
+
+bool suffix( string arg ) {
+	//std::cerr << arg << std::endl;
+	size_t dot = arg.find_last_of( "." );
+	//std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
+	if ( dot == string::npos ) return false;
+	string sx = arg.substr( dot + 1 );
+	for ( int i = 0; i < NumSuffixes; i += 1 ) {
+		if ( sx == suffixes[i] ) return true;
+	} // for
+	return false;
+} // suffix
+
 
 void checkEnv( const char *args[], int &nargs ) {
@@ -51,7 +66,7 @@
 	if ( value != NULL ) {
 		compiler_name = value;
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "env arg:\"" << compiler_name << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 	} // if
 
@@ -59,7 +74,7 @@
 	if ( value != NULL ) {
 		args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "env arg:\"" << args[nargs] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		nargs += 1;
 	} // if
@@ -68,7 +83,7 @@
 	if ( value != NULL ) {
 		args[nargs] = ( *new string( value ) ).c_str(); // pass the argument along
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "env arg:\"" << args[nargs] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		nargs += 1;
 	} // if
@@ -115,7 +130,7 @@
 	signal( SIGTERM, sigTermHandler );
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "Stage1" << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	// process all the arguments
@@ -124,11 +139,11 @@
 
 	for ( i = 1; i < argc; i += 1 ) {
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		arg = argv[i];
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "arg:\"" << arg << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		if ( prefix( arg, "-" ) ) {
 			// strip g++ flags that are inappropriate or cause duplicates in subsequent passes
@@ -164,15 +179,15 @@
 				ncargs += 1;
 				i += 1;									// and the argument
-			} else if ( prefix( arg, D__GCC_X__ ) ) {
-				args[nargs] = "-x";
-				nargs += 1;
-				args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along
-				nargs += 1;
-			} else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {
-				args[nargs] = "-x";
-				nargs += 1;
-				args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along
-				nargs += 1;
-				i += 1;									// and the argument
+			// } else if ( prefix( arg, D__GCC_X__ ) ) {
+			// 	args[nargs] = "-x";
+			// 	nargs += 1;
+			// 	args[nargs] = ( *new string( arg.substr( D__GCC_X__.size() ) ) ).c_str(); // pass the flag along
+			// 	nargs += 1;
+			// } else if ( arg == "-D" && prefix( argv[i + 1], D__GCC_X__.substr(2) ) ) {
+			// 	args[nargs] = "-x";
+			// 	nargs += 1;
+			// 	args[nargs] = ( *new string( string( argv[i + 1] ).substr( D__GCC_X__.size() - 2 ) ) ).c_str(); // pass the flag along
+			// 	nargs += 1;
+			// 	i += 1;									// and the argument
 			} else if ( prefix( arg, D__GCC_BPREFIX__ ) ) {
 				bprefix = arg.substr( D__GCC_BPREFIX__.size() );
@@ -196,7 +211,7 @@
 					args[nargs] = argv[i];				// pass the argument along
 					nargs += 1;
-#ifdef __DEBUG_H__
+					#ifdef __DEBUG_H__
 					cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+					#endif // __DEBUG_H__
 				} else if ( arg == "-MD" || arg == "-MMD" ) {
 					args[nargs] = "-MF";				// insert before file
@@ -205,7 +220,7 @@
 					args[nargs] = argv[i];				// pass the argument along
 					nargs += 1;
-#ifdef __DEBUG_H__
+					#ifdef __DEBUG_H__
 					cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+					#endif // __DEBUG_H__
 				} // if
 			} // if
@@ -213,12 +228,12 @@
 			if ( cpp_in == NULL ) {
 				cpp_in = argv[i];
-#ifdef __DEBUG_H__
+				#ifdef __DEBUG_H__
 				cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
-#endif // __DEBUG_H__
+				#endif // __DEBUG_H__
 			} else if ( cpp_out == NULL ) {
 				cpp_out = argv[i];
-#ifdef __DEBUG_H__
+				#ifdef __DEBUG_H__
 				cerr << "cpp_out:\"" << cpp_out << "\""<< endl;
-#endif // __DEBUG_H__
+				#endif // __DEBUG_H__
 			} else {
 				cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
@@ -228,5 +243,5 @@
 	} // for
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "args:";
 	for ( i = 1; i < nargs; i += 1 ) {
@@ -236,5 +251,5 @@
 	if ( cpp_out != NULL ) cerr << " " << cpp_out;
 	cerr << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	if ( cpp_in == NULL ) {
@@ -258,5 +273,5 @@
 		args[nargs] = NULL;								// terminate argument list
 
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "nargs: " << nargs << endl;
 		for ( i = 0; args[i] != NULL; i += 1 ) {
@@ -264,5 +279,5 @@
 		} // for
 		cerr << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 
 		execvp( args[0], (char *const *)args );			// should not return
@@ -279,7 +294,7 @@
 	} // if
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "tmpname:" << tmpname << " tmpfilefd:" << tmpfilefd << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	// Run the C preprocessor and save the output in tmpfile.
@@ -295,9 +310,15 @@
 
 		args[0] = compiler_name.c_str();
+		if ( suffix( cpp_in ) ) {
+			args[nargs] = "-x";
+			nargs += 1;
+			args[nargs] = "c";
+			nargs += 1;
+		} // if
 		args[nargs] = cpp_in;							// input to cpp
 		nargs += 1;
 		args[nargs] = NULL;								// terminate argument list
 
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "cpp nargs: " << nargs << endl;
 		for ( i = 0; args[i] != NULL; i += 1 ) {
@@ -305,5 +326,5 @@
 		} // for
 		cerr << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 
 		execvp( args[0], (char *const *)args );			// should not return
@@ -314,7 +335,7 @@
 	wait( &code );										// wait for child to finish
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "return code from cpp:" << WEXITSTATUS(code) << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	if ( WIFSIGNALED(code) != 0 ) {						// child failed ?
@@ -352,5 +373,5 @@
 		cargs[ncargs] = NULL;							// terminate argument list
 
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "cfa-cpp ncargs: " << o_name << " " << CFA_flag << " " << ncargs << endl;
 		for ( i = 0; cargs[i] != NULL; i += 1 ) {
@@ -358,5 +379,5 @@
 		} // for
 		cerr << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 
 		execvp( cargs[0], (char * const *)cargs );		// should not return
@@ -367,7 +388,7 @@
 	wait( &code );										// wait for child to finish
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "return code from cfa-cpp:" << WEXITSTATUS(code) << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	// Must unlink here because file must exist across execvp.
@@ -393,7 +414,7 @@
 	int nargs = 1;										// number of arguments in args list; 0 => command name
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "Stage2" << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	// process all the arguments
@@ -402,17 +423,17 @@
 
 	for ( i = 1; i < argc; i += 1 ) {
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		arg = argv[i];
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "arg:\"" << arg << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		if ( prefix( arg, "-" ) ) {
 			// strip inappropriate flags
 
 			if ( arg == "-quiet" || arg == "-version" || arg == "-fpreprocessed" ||
-				 // Currently CFA does not suppose precompiled .h files.
-				 prefix( arg, "--output-pch" ) ) {
+				// Currently CFA does not suppose precompiled .h files.
+				prefix( arg, "--output-pch" ) ) {
 
 				// strip inappropriate flags with an argument
@@ -420,7 +441,7 @@
 			} else if ( arg == "-auxbase" || arg == "-auxbase-strip" || arg == "-dumpbase" ) {
 				i += 1;
-#ifdef __DEBUG_H__
+				#ifdef __DEBUG_H__
 				cerr << "arg:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+				#endif // __DEBUG_H__
 
 				// all other flags
@@ -433,7 +454,7 @@
 					args[nargs] = argv[i];				// pass the argument along
 					nargs += 1;
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 					cerr << "arg:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 				} // if
 			} // if
@@ -441,7 +462,7 @@
 			if ( cpp_in == NULL ) {
 				cpp_in = argv[i];
-#ifdef __DEBUG_H__
+				#ifdef __DEBUG_H__
 				cerr << "cpp_in:\"" << cpp_in << "\"" << endl;
-#endif // __DEBUG_H__
+				#endif // __DEBUG_H__
 			} else {
 				cerr << "Usage: " << argv[0] << " input-file [output-file] [options]" << endl;
@@ -451,5 +472,5 @@
 	} // for
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "args:";
 	for ( i = 1; i < nargs; i += 1 ) {
@@ -458,5 +479,5 @@
 	cerr << endl;
 	if ( cpp_in != NULL ) cerr << " " << cpp_in;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	args[0] = compiler_name.c_str();
@@ -467,5 +488,5 @@
 	args[nargs] = NULL;									// terminate argument list
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "stage2 nargs: " << nargs << endl;
 	for ( i = 0; args[i] != NULL; i += 1 ) {
@@ -473,5 +494,5 @@
 	} // for
 	cerr << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	execvp( args[0], (char * const *)args );			// should not return
@@ -482,9 +503,9 @@
 
 int main( const int argc, const char * const argv[], __attribute__((unused)) const char * const env[] ) {
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	for ( int i = 0; env[i] != NULL; i += 1 ) {
 		cerr << env[i] << endl;
 	} // for
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	string arg = argv[1];
Index: src/driver/cfa.cc
===================================================================
--- src/driver/cfa.cc	(revision 26ef3b2397369bc3bef6e6a70bd6a0d03d84bbd3)
+++ src/driver/cfa.cc	(revision dffaeac743b46e961ffdca195bffbf80bff2d6ad)
@@ -10,6 +10,6 @@
 // Created On       : Tue Aug 20 13:44:49 2002
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon May 14 14:16:33 2018
-// Update Count     : 244
+// Last Modified On : Fri Jul 13 17:40:12 2018
+// Update Count     : 258
 //
 
@@ -37,14 +37,29 @@
 } // prefix
 
+enum { NumSuffixes = 2 };
+const string suffixes[NumSuffixes] = { "cfa", "hfa", };
+
+bool suffix( string arg ) {
+	//std::cerr << arg << std::endl;
+	size_t dot = arg.find_last_of( "." );
+	//std::cerr << dot << " " << (dot != string::npos ? arg.substr( dot + 1 ) : "fred" ) << std::endl;
+	if ( dot == string::npos ) return false;
+	string sx = arg.substr( dot + 1 );
+	for ( int i = 0; i < NumSuffixes; i += 1 ) {
+		if ( sx == suffixes[i] ) return true;
+	} // for
+	return false;
+} // suffix
+
 
 void shuffle( const char *args[], int S, int E, int N ) {
 	// S & E index 1 passed the end so adjust with -1
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "shuffle:" << S << " " << E << " " << N << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 	for ( int j = E-1 + N; j > S-1 + N; j -=1 ) {
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "\t" << j << " " << j-N << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		args[j] = args[j-N];
 	} // for
@@ -79,4 +94,5 @@
 	bool std_flag = false;								// -std= flag
 	bool noincstd_flag = false;							// -no-include-stdhdr= flag
+	bool xflag = false;									// user supplied -x flag
 	bool debugging __attribute(( unused )) = false;		// -g flag
 
@@ -88,18 +104,18 @@
 	int nlibs = 0;
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "CFA:" << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	// process command-line arguments
 
 	for ( int i = 1; i < argc; i += 1 ) {
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "argv[" << i << "]:\"" << argv[i] << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		arg = argv[i];									// convert to string value
-#ifdef __DEBUG_H__
+		#ifdef __DEBUG_H__
 		cerr << "arg:\"" << arg << "\"" << endl;
-#endif // __DEBUG_H__
+		#endif // __DEBUG_H__
 		if ( prefix( arg, "-" ) ) {
 			// pass through arguments
@@ -162,5 +178,6 @@
 				args[nargs] = argv[i];					// pass the argument along
 				nargs += 1;
-			} else if ( arg == "-x" ) {					// lost so force along
+			} else if ( arg == "-x" ) {
+				xflag = true;
 				args[nargs] = argv[i];					// pass the argument along
 				nargs += 1;
@@ -168,11 +185,12 @@
 				args[nargs] = argv[i];					// pass the argument along
 				nargs += 1;
-				args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x
-				nargs += 1;
-			} else if ( prefix( arg, "-x" ) ) {			// lost so force along
-				args[nargs] = argv[i];					// pass the argument along
-				nargs += 1;
-				args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x
-				nargs += 1;
+				// args[nargs] = ( *new string( string("-D__GCC_X__=") + argv[i] ) ).c_str(); // add the argument for -x
+				// nargs += 1;
+			} else if ( prefix( arg, "-x" ) ) {
+				xflag = true;
+				args[nargs] = argv[i];					// pass the argument along
+				nargs += 1;
+				// args[nargs] = ( *new string( string("-D__GCC_X__=") + arg.substr(2) ) ).c_str(); // add the argument for -x
+				// nargs += 1;
 			} else if ( arg == "-w" ) {
 				args[nargs] = argv[i];					// pass the argument along
@@ -246,17 +264,36 @@
 			} // if
 		} else {
+			bool opt = false;
+			if ( ! xflag && suffix( arg ) ) {
+				args[nargs] = "-x";
+				nargs += 1;
+				args[nargs] = "c";
+				nargs += 1;
+				// args[nargs] = ( *new string( string("-D__GCC_X__=c") ) ).c_str(); // add the argument for -x
+				// nargs += 1;
+				opt = true;
+			} // if
 			// concatenate other arguments
 			args[nargs] = argv[i];
 			nargs += 1;
+			if ( opt ) {
+				args[nargs] = "-x";
+				nargs += 1;
+				args[nargs] = "none";
+				nargs += 1;
+				// args[nargs] = ( *new string( string("-D__GCC_X__=none") ) ).c_str(); // add the argument for -x
+				// nargs += 1;
+			} // if
 			nonoptarg = true;
+			xflag = false;
 		} // if
 	} // for
 
-#ifdef __x86_64__
+	#ifdef __x86_64__
 	args[nargs] = "-mcx16";								// allow double-wide CAA
 	nargs += 1;
-#endif // __x86_64__
-
-#ifdef __DEBUG_H__
+	#endif // __x86_64__
+
+	#ifdef __DEBUG_H__
 	cerr << "args:";
 	for ( int i = 1; i < nargs; i += 1 ) {
@@ -264,5 +301,5 @@
 	} // for
 	cerr << endl;
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	if ( cpp_flag && CFA_flag ) {
@@ -283,17 +320,17 @@
 	nargs += 1;
 
-#ifdef HAVE_LIBCFA
+	#ifdef HAVE_LIBCFA
 	if ( link ) {
 		#if ! defined(HAVE_LIBCFA_RELEASE)
-			if ( ! debug ) {
-				cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
-				exit( EXIT_FAILURE );
-			} // if
+		if ( ! debug ) {
+			cerr << "error: Option -nodebug is unavailable, libcfa was not installed." << endl;
+			exit( EXIT_FAILURE );
+		} // if
 		#endif
 		#if ! defined(HAVE_LIBCFA_DEBUG)
-			if ( debug ) {
-				cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
-				exit( EXIT_FAILURE );
-			} // if
+		if ( debug ) {
+			cerr << "error: Option -debug is unavailable, libcfa-d was not installed." << endl;
+			exit( EXIT_FAILURE );
+		} // if
 		#endif
 
@@ -323,5 +360,5 @@
 		nargs += 1;
 	} // if
-#endif // HAVE_LIBCFA
+	#endif // HAVE_LIBCFA
 
 	// Add exception flags (unconditionally)
@@ -419,5 +456,5 @@
 	args[nargs] = NULL;									// terminate with NULL
 
-#ifdef __DEBUG_H__
+	#ifdef __DEBUG_H__
 	cerr << "nargs: " << nargs << endl;
 	cerr << "args:" << endl;
@@ -425,5 +462,5 @@
 		cerr << " \"" << args[i] << "\"" << endl;
 	} // for
-#endif // __DEBUG_H__
+	#endif // __DEBUG_H__
 
 	if ( ! quiet ) {
