Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Decides main name by target #5691

Closed
wants to merge 3 commits into from

3 participants

@ILyoan

Existing rust code decides main name by host environment of rustc.
I think it should be chosen by build target.

This patch is also removing one of the android hacks that is not necessary any longer(I think it was not necessary from the first).

@bors bors referenced this pull request from a commit
@bors bors auto merge of #5691 : ILyoan/rust/main_name, r=graydon
Existing rust code decides main name by host environment of rustc.
I think it should be chosen by build target.

This patch is also removing one of the android hacks that is not necessary any longer(I think it was not necessary from the first).
8f20275
@ILyoan

Add a commit that fixes a test fail.
r?

@thestinger
Collaborator

saw approval from thestinger
at ILyoan@53232f7

Collaborator

merging ILyoan/rust/main_name = 53232f7 into auto

Collaborator

ILyoan/rust/main_name = 53232f7 merged ok, testing candidate = af1baa3

Collaborator

fast-forwarding incoming to auto = af1baa3

@bors bors referenced this pull request from a commit
@bors bors auto merge of #5691 : ILyoan/rust/main_name, r=thestinger
Existing rust code decides main name by host environment of rustc.
I think it should be chosen by build target.

This patch is also removing one of the android hacks that is not necessary any longer(I think it was not necessary from the first).
af1baa3
@bors bors closed this
@jayanderson jayanderson referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 4, 2013
  1. @ILyoan

    Remove a android hack

    ILyoan authored
  2. @ILyoan

    Decides main name by target

    ILyoan authored
  3. @ILyoan

    Fix fileinput test fail

    ILyoan authored
This page is out of date. Refresh to see the latest.
Showing with 14 additions and 25 deletions.
  1. +13 −24 src/librustc/middle/trans/base.rs
  2. +1 −1  src/libstd/fileinput.rs
View
37 src/librustc/middle/trans/base.rs
@@ -2243,17 +2243,17 @@ pub fn create_main_wrapper(ccx: @CrateContext,
}
fn create_entry_fn(ccx: @CrateContext, rust_main: ValueRef) {
- #[cfg(windows)]
- fn main_name() -> ~str { return ~"WinMain@16"; }
- #[cfg(unix)]
- fn main_name() -> ~str { return ~"main"; }
let llfty = T_fn(~[ccx.int_type, T_ptr(T_ptr(T_i8()))], ccx.int_type);
// FIXME #4404 android JNI hacks
let llfn = if *ccx.sess.building_library {
decl_cdecl_fn(ccx.llmod, ~"amain", llfty)
} else {
- decl_cdecl_fn(ccx.llmod, main_name(), llfty)
+ let main_name = match ccx.sess.targ_cfg.os {
+ session::os_win32 => ~"WinMain@16",
+ _ => ~"main",
+ };
+ decl_cdecl_fn(ccx.llmod, main_name, llfty)
};
let llbb = str::as_c_str(~"top", |buf| {
unsafe {
@@ -2284,25 +2284,14 @@ pub fn create_main_wrapper(ccx: @CrateContext,
let opaque_crate_map = llvm::LLVMBuildPointerCast(
bld, crate_map, T_ptr(T_i8()), noname());
- if *ccx.sess.building_library {
- ~[
- retptr,
- C_null(T_opaque_box_ptr(ccx)),
- opaque_rust_main,
- llvm::LLVMConstInt(T_i32(), 0u as c_ulonglong, False),
- llvm::LLVMConstInt(T_i32(), 0u as c_ulonglong, False),
- opaque_crate_map
- ]
- } else {
- ~[
- retptr,
- C_null(T_opaque_box_ptr(ccx)),
- opaque_rust_main,
- llvm::LLVMGetParam(llfn, 0 as c_uint),
- llvm::LLVMGetParam(llfn, 1 as c_uint),
- opaque_crate_map
- ]
- }
+ ~[
+ retptr,
+ C_null(T_opaque_box_ptr(ccx)),
+ opaque_rust_main,
+ llvm::LLVMGetParam(llfn, 0 as c_uint),
+ llvm::LLVMGetParam(llfn, 1 as c_uint),
+ opaque_crate_map
+ ]
};
unsafe {
View
2  src/libstd/fileinput.rs
@@ -534,7 +534,7 @@ mod test {
fn test_empty_files() {
let filenames = pathify(vec::from_fn(
3,
- |i| fmt!("tmp/lib-fileinput-test-next-file-%u.tmp", i)),true);
+ |i| fmt!("tmp/lib-fileinput-test-empty-files-%u.tmp", i)),true);
make_file(filenames[0].get_ref(), ~[~"1", ~"2"]);
make_file(filenames[1].get_ref(), ~[]);
Something went wrong with that request. Please try again.