SF.net SVN: ant-contrib:[175] cpptasks/trunk/src/main/java/net/sf/ antcontrib/cpptasks/gcc/GccCCompiler.java

[email protected] Wed, 01 Oct 2008 15:18:49 +0000
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Revision: 175
          http://ant-contrib.svn.sourceforge.net/ant-contrib/?rev=175&view=rev
Author:   jonkri
Date:     2008-10-01 15:18:44 +0000 (Wed, 01 Oct 2008)

Log Message:
-----------
Fixed support for long MinGW Windows commands. Thanks to Curt Arnold for pointing at this solution.

Modified Paths:
--------------
    cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java

Modified: cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java
===================================================================
--- cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java	2008-09-26 12:36:25 UTC (rev 174)
+++ cpptasks/trunk/src/main/java/net/sf/antcontrib/cpptasks/gcc/GccCCompiler.java	2008-10-01 15:18:44 UTC (rev 175)
@@ -1,5 +1,5 @@
 /*
- * 
+ *
  * Copyright 2001-2004 The Ant-Contrib project
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,7 +32,7 @@
 
 /**
  * Adapter for the GCC C/C++ compiler
- * 
+ *
  * @author Adam Murdoch
  */
 public final class GccCCompiler extends GccCompatibleCCompiler {
@@ -106,14 +106,14 @@
                 libtoolCompiler, newEnvironment, env);
         isPICMeaningful = System.getProperty("os.name").indexOf("Windows") < 0;
     }
-    public void addImpliedArgs(final Vector args, 
+    public void addImpliedArgs(final Vector args,
     		final boolean debug,
-            final boolean multithreaded, 
-			final boolean exceptions, 
+            final boolean multithreaded,
+			final boolean exceptions,
 			final LinkType linkType,
 			final Boolean rtti,
 			final OptimizationEnum optimization) {
-        super.addImpliedArgs(args, debug, multithreaded, 
+        super.addImpliedArgs(args, debug, multithreaded,
         		exceptions, linkType, rtti, optimization);
         if (isPICMeaningful && linkType.isSharedLibrary()) {
             args.addElement("-fPIC");
@@ -130,9 +130,9 @@
     }
     /**
      * Create parser to determine dependencies.
-     * 
+     *
      * Will create appropriate parser (C++, FORTRAN) based on file extension.
-     *  
+     *
      */
     protected Parser createParser(File source) {
         if (source != null) {
@@ -237,6 +237,16 @@
         return GccLinker.getInstance().getLinker(linkType);
     }
     public int getMaximumCommandLength() {
-        return Integer.MAX_VALUE;
+    	/*
+    	 * Window-specific compilers use a limit of 2048 to prevent over
+    	 * running the available command line length, while the Unix compilers
+    	 * assume that they have an unlimited command line.
+    	 */
+    	if(System.getProperty("os.name").indexOf("Windows") >= 0) {
+    		return 2048;
+    	}
+    	else {
+    		return Integer.MAX_VALUE;
+    	}
     }
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/