forked from cil-project/cil
-
Notifications
You must be signed in to change notification settings - Fork 21
Fix merging and renaming of inlines #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
48c970f
add test cases
stilscher 6d4cae2
implement c99 inline semantic
stilscher 5af589d
inline semantics based on c99mode
stilscher 96f7a07
remove leftovers of msvcMode
stilscher 53d5ab0
set cstd based on gcc parameters
stilscher f0799af
fixes
stilscher 0777acb
add tests for inline gnu89 vs c99
stilscher 2f8df89
add some more tests
stilscher 77754f0
fix: rename only non-external inline functions
stilscher 6bd9414
set float c99mode based on cstd
stilscher 6c0272f
separate flag for gnu89inline
stilscher 7208e8b
move options to cil
stilscher 8d08752
add comments
stilscher b117e7d
make gnu89 inline test a merge test
stilscher f95a689
fix the descriptions of options for printing
stilscher File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| Wes Weimer <[email protected]> | ||
| Ben Liblit <[email protected]> | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
|
|
@@ -39,16 +39,16 @@ | |
| open GoblintCil | ||
| module E = Errormsg | ||
|
|
||
| let setDebugFlag v name = | ||
| let setDebugFlag v name = | ||
| E.debugFlag := v; | ||
| if v then Pretty.flushOften := true | ||
|
|
||
| type outfile = | ||
| type outfile = | ||
| { fname: string; | ||
| fchan: out_channel } | ||
| fchan: out_channel } | ||
|
|
||
| (* Processign of output file arguments *) | ||
| let openFile (what: string) (takeit: outfile -> unit) (fl: string) = | ||
| let openFile (what: string) (takeit: outfile -> unit) (fl: string) = | ||
| if !E.verboseFlag then | ||
| ignore (Printf.printf "Setting %s to %s\n" what fl); | ||
| (try takeit { fname = fl; | ||
|
|
@@ -58,44 +58,44 @@ let openFile (what: string) (takeit: outfile -> unit) (fl: string) = | |
|
|
||
|
|
||
| let fileNames : string list ref = ref [] | ||
| let recordFile fname = | ||
| fileNames := fname :: (!fileNames) | ||
| let recordFile fname = | ||
| fileNames := fname :: (!fileNames) | ||
|
|
||
| (* Parsing of files with additional names *) | ||
| let parseExtraFile (s: string) = | ||
| let parseExtraFile (s: string) = | ||
| try | ||
| let sfile = open_in s in | ||
| while true do | ||
| let line = try input_line sfile with e -> (close_in sfile; raise e) in | ||
| let linelen = String.length line in | ||
| let rec scan (pos: int) (* next char to look at *) | ||
| (start: int) : unit (* start of the word, | ||
| (start: int) : unit (* start of the word, | ||
| or -1 if none *) = | ||
| if pos >= linelen then | ||
| if start >= 0 then | ||
| if pos >= linelen then | ||
| if start >= 0 then | ||
| recordFile (String.sub line start (pos - start)) | ||
| else | ||
| else | ||
| () (* Just move on to the next line *) | ||
| else | ||
| let c = String.get line pos in | ||
| match c with | ||
| ' ' | '\n' | '\r' | '\t' -> | ||
| match c with | ||
| ' ' | '\n' | '\r' | '\t' -> | ||
| (* whitespace *) | ||
| if start >= 0 then begin | ||
| recordFile (String.sub line start (pos - start)); | ||
| end; | ||
| scan (pos + 1) (-1) | ||
|
|
||
| | _ -> (* non-whitespace *) | ||
| if start >= 0 then | ||
| scan (pos + 1) start | ||
| if start >= 0 then | ||
| scan (pos + 1) start | ||
| else | ||
| scan (pos + 1) pos | ||
| in | ||
| scan 0 (-1) | ||
| done | ||
| with Sys_error _ -> E.s (E.error "Cannot find extra file: %s" s) | ||
| | End_of_file -> () | ||
| | End_of_file -> () | ||
|
|
||
|
|
||
| let options : (string * Arg.spec * string) list = | ||
|
|
@@ -130,7 +130,7 @@ let options : (string * Arg.spec * string) list = | |
| Arg.Clear E.warnFlag, | ||
| (" Disable optional warnings" ^ is_default (not !E.warnFlag)); | ||
|
|
||
| "--noTruncateWarning", | ||
| "--noTruncateWarning", | ||
| Arg.Clear Cil.warnTruncate, | ||
| " Suppress warning about truncating integer constants"; | ||
|
|
||
|
|
@@ -165,7 +165,17 @@ let options : (string * Arg.spec * string) list = | |
| "--strictcheck", Arg.Unit (fun _ -> Cilutil.doCheck := true; | ||
| Cilutil.strictChecking := true), | ||
| " Same as --check, but treats problems as errors not warnings."; | ||
| "", Arg.Unit (fun _ -> ()), ""; | ||
|
|
||
| "--cstd", Arg.String (fun s -> Cil.cstd := Cil.cstd_of_string s), | ||
| " Specify the c language standard. Choose between c90, c99, c11"; | ||
|
|
||
| "--gnu89inline", Arg.Set Cil.gnu89inline, | ||
| "Use gnu89 semantic for inlining"; | ||
stilscher marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| "--mergeinlines", Arg.Unit (fun _ -> Mergecil.merge_inlines := true), | ||
| " Try to merge definitions of inline functions. They can appear in multiple | ||
| files and we would like them all to be the same. This can slow down the | ||
| merger an order of magnitude."; | ||
michael-schwarz marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| "--noPrintLn", | ||
| Arg.Unit (fun _ -> | ||
|
|
@@ -179,7 +189,7 @@ let options : (string * Arg.spec * string) list = | |
| Cprint.printLnComment := true), | ||
| " Print #line directives in the output, but put them in comments"; | ||
|
|
||
| "--commPrintLnSparse", | ||
| "--commPrintLnSparse", | ||
| Arg.Unit (fun _ -> | ||
| Cil.lineDirectiveStyle := Some Cil.LineCommentSparse; | ||
| Cprint.printLnComment := true), | ||
|
|
@@ -204,7 +214,7 @@ let options : (string * Arg.spec * string) list = | |
| try | ||
| let machineModel = Sys.getenv "CIL_MACHINE" in | ||
| Cil.envMachine := Some (Machdepenv.modelParse machineModel); | ||
| with | ||
| with | ||
| Not_found -> | ||
| ignore (E.error "CIL_MACHINE environment variable is not set") | ||
| | Failure msg -> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,11 @@ | ||
| (* | ||
|
|
||
| Copyright (c) 2001-2002, | ||
| Copyright (c) 2001-2002, | ||
| George C. Necula <[email protected]> | ||
| Scott McPeak <[email protected]> | ||
| Wes Weimer <[email protected]> | ||
| All rights reserved. | ||
|
|
||
| Redistribution and use in source and binary forms, with or without | ||
| modification, are permitted provided that the following conditions are | ||
| met: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.