Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Allow compiling with clang++ using -std=c++11 flag #2956

Merged
merged 1 commit into from

2 participants

@southerngs

I need to use c++11 features for something I'm working on, and I usually build with clang. I had to
make a couple of changes for this to work and I thought they might also be useful for the mainline.

Patch includes changes needed for CXXFLAGS=-std=c++11 to work
with clang++.

1) configure script should run in c++ mode when checking functions
otherwise clang++ gives an error.

2)typeof operator doesn't work in c++11 mode with clang++. But
__typeof__ is a valid replacement.

@dbussink
Owner

Which version of clang are you using? We also run CI on Travis against clang / clang++, it is the default compiler on OS X and also the latest 3.4 has been testing. I'm wondering which version you're using that shows these issues.

@southerngs

I'm using clang 3.3 compiled from source on Ubuntu 12.04. Normally it is fine, but when I passed in the flag -std=c++11 there were some errors with the configure script and compiling.

@dbussink
Owner

@southerngs I've done some cleanup of the Bignum parts here, could you rebase this against master so we can merge it?

@southerngs southerngs Allow compiling with clang++ using -std=c++11 flag
configure script should run in c++ mode when checking functions
otherwise clang++ gives an error.
f8ffbcb
@southerngs

@dbussink I did the rebase. Since you cleaned up Bignum the only change now is in the configure script so that it treats the input as C++ files instead of C.

@dbussink dbussink merged commit 27106e4 into rubinius:master
@dbussink
Owner

@southerngs Thanks!

I did the cleanup mostly because that code seemed to be useless anyway, so I'd rather remove it than trying to work around behavior differences between C++ modes in clang :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2014
  1. @southerngs

    Allow compiling with clang++ using -std=c++11 flag

    southerngs authored
    configure script should run in c++ mode when checking functions
    otherwise clang++ gives an error.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 configure
View
4 configure
@@ -1279,7 +1279,7 @@ int main() { return tgetnum(""); }
includes.each do |i|
src.puts "#include <#{i}>"
end
- src.puts "int main() { void* ptr = &#{name}; }"
+ src.puts "int main() { void* ptr = (void *) &#{name}; }"
end
end
@@ -1334,7 +1334,7 @@ int main() { return tgetnum(""); }
@log.log string
- cmd = "#{@cxx} -S -o - -x c #{defines.join(" ")} #{@user_cppflags} #{@user_cxxflags} #{@user_cflags} #{@user_ldflags} #{@system_cppflags} #{@system_cxxflags} #{@system_cflags} #{@system_ldflags} #{file.path} >>#{@log.path} 2>&1"
+ cmd = "#{@cxx} -S -o - -x c++ #{defines.join(" ")} #{@user_cppflags} #{@user_cxxflags} #{@user_cflags} #{@user_ldflags} #{@system_cppflags} #{@system_cxxflags} #{@system_cflags} #{@system_ldflags} #{file.path} >>#{@log.path} 2>&1"
@log.log cmd
system cmd
Something went wrong with that request. Please try again.