Skip to content

Commit 4c802f1

Browse files
dsymeKevinRansom
authored andcommitted
GCC errors
1 parent 82caca0 commit 4c802f1

File tree

16 files changed

+152
-1
lines changed

16 files changed

+152
-1
lines changed

src/fsharp/CompileOps.fs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,7 @@ type ErrorStyle =
13451345
| EmacsErrors
13461346
| TestErrors
13471347
| VSErrors
1348+
| GccErrors
13481349

13491350
let SanitizeFileName fileName implicitIncludeDir =
13501351
// The assert below is almost ok, but it fires in two cases:
@@ -1419,6 +1420,11 @@ let CollectErrorOrWarning (implicitIncludeDir,showFullPaths,flattenErrors,errorS
14191420
let m = mkRange m.FileName (mkPos m.StartLine (m.StartColumn + 1)) (mkPos m.EndLine (m.EndColumn + 1) )
14201421
sprintf "%s(%d,%d-%d,%d): " file m.StartLine m.StartColumn m.EndLine m.EndColumn, m, file
14211422

1423+
| ErrorStyle.GccErrors ->
1424+
let file = file.Replace('/',System.IO.Path.DirectorySeparatorChar)
1425+
let m = mkRange m.FileName (mkPos m.StartLine (m.StartColumn + 1)) (mkPos m.EndLine (m.EndColumn + 1) )
1426+
sprintf "%s:%d:%d: " file m.StartLine m.StartColumn, m, file
1427+
14221428
// Here, we want the complete range information so Project Systems can generate proper squiggles
14231429
| ErrorStyle.VSErrors ->
14241430
// Show prefix only for real files. Otherise, we just want a truncated error like:
@@ -1990,6 +1996,7 @@ type TcConfigBuilder =
19901996
/// if true - every expression in quotations will be augmented with full debug info (filename, location in file)
19911997
mutable emitDebugInfoInQuotations : bool
19921998

1999+
mutable exename : string option
19932000
/// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*)
19942001
mutable shadowCopyReferences : bool
19952002
}
@@ -2127,6 +2134,7 @@ type TcConfigBuilder =
21272134
sqmNumOfSourceFiles = 0
21282135
sqmSessionStartedTime = System.DateTime.Now.Ticks
21292136
emitDebugInfoInQuotations = false
2137+
exename = None
21302138
shadowCopyReferences = false
21312139
}
21322140

src/fsharp/CompileOps.fsi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ type ErrorStyle =
7878
| DefaultErrors
7979
| EmacsErrors
8080
| TestErrors
81-
| VSErrors
81+
| VSErrors
82+
| GccErrors
8283

8384
/// Get the location associated with an error
8485
val GetRangeOfError : PhasedError -> range option
@@ -314,6 +315,7 @@ type TcConfigBuilder =
314315
mutable sqmNumOfSourceFiles : int
315316
sqmSessionStartedTime : int64
316317
mutable emitDebugInfoInQuotations : bool
318+
mutable exename : string option
317319
mutable shadowCopyReferences : bool }
318320

319321

src/fsharp/CompileOptions.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,8 @@ let vsSpecificFlags (tcConfigB: TcConfigBuilder) =
737737
CompilerOption("LCID", tagInt, OptionInt (fun n -> tcConfigB.lcid <- Some(n)), None, None);
738738
CompilerOption("flaterrors", tagNone, OptionUnit (fun () -> tcConfigB.flatErrors <- true), None, None);
739739
CompilerOption("sqmsessionguid", tagNone, OptionString (fun s -> tcConfigB.sqmSessionGuid <- try System.Guid(s) |> Some with e -> None), None, None);
740+
CompilerOption("gccerrors", tagNone, OptionUnit (fun () -> tcConfigB.errorStyle <- ErrorStyle.GccErrors), None, None);
741+
CompilerOption("exename", tagNone, OptionString (fun s -> tcConfigB.exename <- Some(s)), None, None);
740742
CompilerOption("maxerrors", tagInt, OptionInt (fun n -> tcConfigB.maxErrors <- n), None, None); ]
741743

742744

src/fsharp/fsi/fsi.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,9 @@ type internal FsiCommandLineOptions(argv: string[], tcConfigB, fsiConsoleOutput:
427427

428428
let executableFileName =
429429
lazy
430+
match tcConfigB.exename with
431+
| Some s -> s
432+
| None ->
430433
let currentProcess = System.Diagnostics.Process.GetCurrentProcess()
431434
Path.GetFileName(currentProcess.MainModule.FileName)
432435

tests/fsharp/typecheck/sigs/build.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ call ..\..\single-neg-test.bat neg93
2323
call ..\..\single-neg-test.bat neg92
2424
@if ERRORLEVEL 1 goto Error
2525

26+
2627
call ..\..\single-neg-test.bat neg91
2728
@if ERRORLEVEL 1 goto Error
2829

@@ -535,6 +536,8 @@ call ..\..\single-neg-test.bat neg35
535536
"%FSC%" %fsc_flags% -a -o:pos05.dll pos05.fs
536537
@if ERRORLEVEL 1 goto Error
537538

539+
REM --------Exit points------------------------
540+
538541
:Ok
539542
echo Built fsharp %~f0 ok.
540543
endlocal

tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117
//<Expects status="success">section='NoSection ' ! option=no-string-interning kind=OptionUnit</Expects>
118118
//<Expects status="success">section='NoSection ' ! option=statistics kind=OptionUnit</Expects>
119119
//<Expects status="success">section='NoSection ' ! option=generate-filter-blocks kind=OptionUnit</Expects>
120+
//<Expects status="success">section='NoSection ' ! option=gccerrors kind=OptionUnit</Expects>
121+
//<Expects status="success">section='NoSection ' ! option=exename kind=OptionString</Expects>
120122
//<Expects status="success">section='NoSection ' ! option=max-errors kind=OptionInt</Expects>
121123
//<Expects status="success">section='NoSection ' ! option=debug-file kind=OptionString</Expects>
122124
//<Expects status="success">section='NoSection ' ! option=no-debug-file kind=OptionUnit</Expects>

tests/fsharpqa/Source/CompilerOptions/fsc/dumpAllCommandLineOptions/dummy.fsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@
137137
//<Expects status="notin">section='NoSection ' ! option=no-string-interning kind=OptionUnit</Expects>
138138
//<Expects status="notin">section='NoSection ' ! option=statistics kind=OptionUnit</Expects>
139139
//<Expects status="notin">section='NoSection ' ! option=generate-filter-blocks kind=OptionUnit</Expects>
140+
//<Expects status="notin">section='NoSection ' ! option=gccerrors kind=OptionUnit</Expects>
141+
//<Expects status="notin">section='NoSection ' ! option=exename kind=OptionString</Expects>
140142
//<Expects status="notin">section='NoSection ' ! option=max-errors kind=OptionInt</Expects>
141143
//<Expects status="notin">section='NoSection ' ! option=debug-file kind=OptionString</Expects>
142144
//<Expects status="notin">section='NoSection ' ! option=no-debug-file kind=OptionUnit</Expects>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// #NoMT #CompilerOptions #RequiresENU #NETFX20Only #NETFX40Only
2+
let fn1 = fsi.CommandLineArgs.[1]
3+
let fn2 = fsi.CommandLineArgs.[2]
4+
// Read file into an array
5+
let File2List(filename : string) = System.IO.File.ReadAllLines filename |> Array.toList
6+
let f1 = File2List fn1
7+
let f2 = File2List fn2
8+
let mutable i = 0
9+
10+
let compare f1 f2 =
11+
(f1, f2) ||> List.forall2 (fun (a : string) (b : string) ->
12+
i <- i + 1
13+
if (a = b) then true
14+
else
15+
printfn "Files differ at line %d:" i
16+
printfn "\t>> %s" a
17+
printfn "\t<< %s" b
18+
false)
19+
20+
exit (if (f1.Length = f2.Length && compare f1 f2) then 0
21+
else 1)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ReqENU SOURCE=gccerrors01.fs COMPILE_ONLY=1 SCFLAGS="--gccerrors --nologo gccerrors01.fs >gccerrors01.txt" POSTCMD="\$FSI_PIPE --nologo --quiet --exec comparer.fsx gccerrors01.txt gccerrors01.bsl"
2+
3+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
gccerrors01.fs:7:11: warning FS0025: Incomplete pattern matches on this expression. For example, the value '1' may indicate a case not covered by the pattern(s).
3+
4+
gccerrors01.fs:8:14: warning FS0988: Main module of program is empty: nothing will happen when it is run

0 commit comments

Comments
 (0)