mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-04 14:17:07 +00:00 
			
		
		
		
	Use gnu11 standard when none is specified (#231)
Reference: 1. https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes 2. https://gcc.gnu.org/onlinedocs/gcc/Standards.html
This commit is contained in:
		
							parent
							
								
									e2ce134e1f
								
							
						
					
					
						commit
						2a7b593a80
					
				@ -137,7 +137,7 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(
 | 
			
		||||
    }
 | 
			
		||||
    if (!AnyStartsWith(entry.args, "-std=")) {
 | 
			
		||||
      if (*source_file_type == "c")
 | 
			
		||||
        result.args.push_back("-std=c11");
 | 
			
		||||
        result.args.push_back("-std=gnu11");
 | 
			
		||||
      else if (*source_file_type == "c++")
 | 
			
		||||
        result.args.push_back("-std=c++11");
 | 
			
		||||
    }
 | 
			
		||||
@ -516,7 +516,7 @@ TEST_SUITE("Project") {
 | 
			
		||||
        "/home/user", "/home/user/foo/bar.c",
 | 
			
		||||
        /* raw */ {"cc", "-O0", "foo/bar.c"},
 | 
			
		||||
        /* expected */
 | 
			
		||||
        {"cc", "-working-directory", "/home/user", "-xc", "-std=c11", "-O0", "-resource-dir=/w/resource_dir/",
 | 
			
		||||
        {"cc", "-working-directory", "/home/user", "-xc", "-std=gnu11", "-O0", "-resource-dir=/w/resource_dir/",
 | 
			
		||||
         "-Wno-unknown-warning-option", "-fparse-all-comments"});
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user