working on it ...
Explore Public Snippets
Found 883 snippets matching: gcc
public by David Grayson 198572 1 3 0
Woe unto any user that doesn't know that "pow" is a standard library function in C. The C standard allows this inconsistent behavior, sadly (Section 7.1.3 of N1124). I think C++ is better, at least based on how GCC behaves.
Woe unto any user that doesn't know that "pow" is a standard library function in C. The C standard allows this inconsistent behavior, sadly (Section 7.1.3 of N1124). I think C++ is better, at least based on how GCC behaves.:
pow_wtf.c
#include <stdio.h> double pow(double x, double y) { return x + y; } int main() { volatile int y = 1; printf("%f\n", pow(10, y)); // prints 11.000000 printf("%f\n", pow(10, 1)); // prints 10.000000 return 0; }
public by lbottaro 3314 1 6 0
Bash IP PPP interface status test
This script test IP/PPP interface status on linux
#!/bin/sh echo "======= TEST RUNNING ========" sleep $((60*15)) IF0_STATE=`ifconfig ptp_040 | grep RUNNING | wc -l` IF1_STATE=`ifconfig ptp_041 | grep RUNNING | wc -l` if [ ${IF0_STATE} -eq 1 ] && [ ${IF1_STATE} -eq 1 ] ; then echo "PASSED!" # reboot else while [ 1 ]; do echo "FAILED IF0_STATE : ${IF0_STATE} IF1_STATE:${IF1_STATE}" sleep 10 done fi
Para o erro: error: command 'gcc' failed with exit status 1 Executar os seguintes comandos apt-get install python-dev apt-get install libxml2-dev apt-get install libxslt1-dev[/sourcecode]
external by goyox86 389 0 3 0
GCC 4.9 Patch for OS X 10.10
GCC 4.9 Patch for OS X 10.10 :
gcc49.patch
--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -, +, @@ --- a/gcc/config/darwin-c.c +++ a/gcc/config/darwin-c.c @@ -572,20 +572,31 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) /* Return the value of darwin_macosx_version_min suitable for the __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. - Print a warning if the version number can't be understood. */ + so '10.4.2' becomes 1040 and '10.10.0' becomes 101000. The lowest + digit is always zero. Print a warning if the version number + can't be understood. */ static const char * version_as_macro (void) { - static char result[] = "1000"; + static char result[7] = "1000"; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, "10.", 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - && darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT(darwin_macosx_version_min[minorDigitIdx])) { + /* Starting with 10.10 numeration for mactro changed */ + result[3] = darwin_macosx_version_min[minorDigitIdx++]; + result[4] = '0'; + result[5] = '0'; + result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + && darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; --- a/gcc/config/darwin-driver.c +++ a/gcc/config/darwin-driver.c @@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers > 4 + 9) + if (major_vers > 4 + 10) goto parse_failed; if (*version_p++ != '.') goto parse_failed; --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -835,8 +835,10 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC && ( !defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T) CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); +#elif SANITIZER_MAC +// There is no d_seekoff with non 64-bit ino_t #else CHECK_SIZE_AND_OFFSET(dirent, d_off); #endif --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -275,12 +275,20 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +# if ! defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +# else + struct __sanitizer_dirent { + unsigned int d_ino; + unsigned short d_reclen; + // more fields that we don't care about + }; +# endif #elif SANITIZER_ANDROID || defined(__x86_64__) struct __sanitizer_dirent { unsigned long long d_ino;
external by beci 331 2 3 0
use gcc 5.x on ubuntu 14.04
use gcc 5.x on ubuntu 14.04:
gcc 5 on ubuntu 14.04
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install gcc-5 g++-5 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
external by indivisible 320 0 3 0
fix for lachs0r's mingw build on gcc 4.9.1
fix for lachs0r's mingw build on gcc 4.9.1:
gistfile1.txt
diff --git a/toolchain/CMakeLists.txt b/toolchain/CMakeLists.txt index 336edbe..69666fe 100644 --- a/toolchain/CMakeLists.txt +++ b/toolchain/CMakeLists.txt @@ -8,6 +8,7 @@ ExternalProject_Add(binutils --disable-multilib --disable-nls --disable-shared + --disable-werror BUILD_COMMAND make -j${MAKEJOBS} INSTALL_COMMAND make install LOG_DOWNLOAD 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1
external by misterdjules 251 0 3 0
Patch to build node v0.12 with gcc and g++ 4.4.7-1 on Centos
Patch to build node v0.12 with gcc and g++ 4.4.7-1 on Centos:
gistfile1.diff
diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 39c8800..3c31b0b 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -73,7 +73,7 @@ class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> { GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) { + : ReqWrap<uv_getaddrinfo_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) { Wrap(req_wrap_obj, this); } @@ -90,7 +90,7 @@ class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> { GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { + : ReqWrap<uv_getnameinfo_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { Wrap(req_wrap_obj, this); } diff --git a/src/node_file.cc b/src/node_file.cc diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 39c8800..3c31b0b 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -73,7 +73,7 @@ class GetAddrInfoReqWrap : public ReqWrap<uv_getaddrinfo_t> { GetAddrInfoReqWrap::GetAddrInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) { + : ReqWrap<uv_getaddrinfo_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_GETADDRINFOREQWRAP) { Wrap(req_wrap_obj, this); } @@ -90,7 +90,7 @@ class GetNameInfoReqWrap : public ReqWrap<uv_getnameinfo_t> { GetNameInfoReqWrap::GetNameInfoReqWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { + : ReqWrap<uv_getnameinfo_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_GETNAMEINFOREQWRAP) { Wrap(req_wrap_obj, this); } diff --git a/src/node_file.cc b/src/node_file.cc index 8a00b5d..e04c4c2 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -75,7 +75,7 @@ class FSReqWrap: public ReqWrap<uv_fs_t> { Local<Object> req, const char* syscall, char* data = NULL) - : ReqWrap(env, req, AsyncWrap::PROVIDER_FSREQWRAP), + : ReqWrap<uv_fs_t>(env, req, AsyncWrap::PROVIDER_FSREQWRAP), syscall_(syscall), data_(data), dest_len_(0) { diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 69cdfcd..2d49199 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -61,7 +61,7 @@ class PipeConnectWrap : public ReqWrap<uv_connect_t> { PipeConnectWrap::PipeConnectWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPEWRAP) { + : ReqWrap<uv_connect_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPEWRAP) { Wrap(req_wrap_obj, this); } diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 38e5d48..aaa06d0 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -36,7 +36,7 @@ class StreamWrap; class ShutdownWrap : public ReqWrap<uv_shutdown_t> { public: ShutdownWrap(Environment* env, v8::Local<v8::Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_SHUTDOWNWRAP) { + : ReqWrap<uv_shutdown_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_SHUTDOWNWRAP) { Wrap(req_wrap_obj, this); } @@ -50,7 +50,7 @@ class WriteWrap: public ReqWrap<uv_write_t> { // TODO(trevnorris): WrapWrap inherits from ReqWrap, which I've globbed // into the same provider. How should these be broken apart? WriteWrap(Environment* env, v8::Local<v8::Object> obj, StreamWrap* wrap) - : ReqWrap(env, obj, AsyncWrap::PROVIDER_WRITEWRAP), + : ReqWrap<uv_write_t>(env, obj, AsyncWrap::PROVIDER_WRITEWRAP), wrap_(wrap) { Wrap(obj, this); } diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index a5b20a6..6b2408c 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -61,7 +61,7 @@ class TCPConnectWrap : public ReqWrap<uv_connect_t> { TCPConnectWrap::TCPConnectWrap(Environment* env, Local<Object> req_wrap_obj) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_TCPWRAP) { + : ReqWrap<uv_connect_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_TCPWRAP) { Wrap(req_wrap_obj, this); } diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 614326f..923875e 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -64,7 +64,7 @@ class SendWrap : public ReqWrap<uv_udp_send_t> { SendWrap::SendWrap(Environment* env, Local<Object> req_wrap_obj, bool have_callback) - : ReqWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_UDPWRAP), + : ReqWrap<uv_udp_send_t>(env, req_wrap_obj, AsyncWrap::PROVIDER_UDPWRAP), have_callback_(have_callback) { Wrap(req_wrap_obj, this); }
external by Romain Bossart 167 0 2 0
patch for gcc 4.9.1 (adapted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407)
patch for gcc 4.9.1 (adapted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407):
gcc-xcode6-dp.diff
diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x index 10b4061..8a7985a 100644 --- a/fixincludes/fixincl.x +++ b/fixincludes/fixincl.x @@ -15,7 +15,7 @@ * certain ANSI-incompatible system header files which are fixed to work * correctly with ANSI C and placed in a directory that GNU C will search. * - * This file contains 229 fixup descriptions. + * This file contains 230 fixup descriptions. * * See README for more information. * @@ -9399,13 +9399,55 @@ static const char* apzX11_SprintfPatch[] = { (char*)NULL }; + +/* * * * * * * * * * * * * * * * * * * * * * * * * * + * + * Description of Darwin14_Has_Feature fix + */ +tSCC zDarwin14_Has_FeatureName[] = + "darwin14_has_feature"; + +/* + * File name selection pattern + */ +tSCC zDarwin14_Has_FeatureList[] = + "Availability.h\0"; +/* + * Machine/OS name selection pattern + */ +tSCC* apzDarwin14_Has_FeatureMachs[] = { + "*-*-darwin14.0*", + (const char*)NULL }; +#define DARWIN14_HAS_FEATURE_TEST_CT 0 +#define aDarwin14_Has_FeatureTests (tTestDesc*)NULL + +/* + * Fix Command Arguments for Darwin14_Has_Feature + */ +static const char* apzDarwin14_Has_FeaturePatch[] = { + "wrap", + "\n\ +/* GCC doesn't support __has_feature built-in in C mode and\n\ + * using defined(__has_feature) && __has_feature in the same\n\ + * macro expression is not valid. So, easiest way is to define\n\ + * for this header __has_feature as a macro, returning 0, in case\n\ + * it is not defined internally\n\ + */\n\ +#ifndef __has_feature\n\ +#define __has_feature(x) 0\n\ +#endif\n", + (char*)NULL }; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * List of all fixes */ #define REGEX_COUNT 268 #define MACH_LIST_SIZE_LIMIT 187 -#define FIX_COUNT 229 +#define FIX_COUNT 230 /* * Enumerate the fixes @@ -9639,7 +9681,8 @@ typedef enum { X11_CLASS_FIXIDX, X11_CLASS_USAGE_FIXIDX, X11_NEW_FIXIDX, - X11_SPRINTF_FIXIDX + X11_SPRINTF_FIXIDX, + DARWIN14_HAS_FEATURE_FIXIDX } t_fixinc_idx; tFixDesc fixDescList[ FIX_COUNT ] = { @@ -10786,5 +10829,10 @@ tFixDesc fixDescList[ FIX_COUNT ] = { { zX11_SprintfName, zX11_SprintfList, apzX11_SprintfMachs, X11_SPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, - aX11_SprintfTests, apzX11_SprintfPatch, 0 } + aX11_SprintfTests, apzX11_SprintfPatch, 0 }, + + { zDarwin14_Has_FeatureName, zDarwin14_Has_FeatureList, + apzDarwin14_Has_FeatureMachs, + DARWIN14_HAS_FEATURE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE, + aDarwin14_Has_FeatureTests, apzDarwin14_Has_FeaturePatch, 0 } }; diff --git a/fixincludes/inclhack.def b/fixincludes/inclhack.def index 411300f..0f53a8e 100644 --- a/fixincludes/inclhack.def +++ b/fixincludes/inclhack.def @@ -4881,4 +4881,33 @@ fix = { test_text = "extern char *\tsprintf();"; }; + +/* + * Fix stdio.h using C++ __has_feature built-in on OS X 10.10 + */ +fix = { + hackname = darwin14_has_feature; + files = Availability.h; + mach = "*-*-darwin14.0*"; + + c_fix = wrap; + c_fix_arg = <<- _HasFeature_ + +/* + * GCC doesn't support __has_feature built-in in C mode and + * using defined(__has_feature) && __has_feature in the same + * macro expression is not valid. So, easiest way is to define + * for this header __has_feature as a macro, returning 0, in case + * it is not defined internally + */ +#ifndef __has_feature +#define __has_feature(x) 0 +#endif + + +_HasFeature_; + + test_text = ''; +}; + /*EOF*/ diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c index 892ba35..08d5daa 100644 --- a/gcc/config/darwin-c.c +++ b/gcc/config/darwin-c.c @@ -572,20 +572,31 @@ find_subframework_header (cpp_reader *pfile, const char *header, cpp_dir **dirp) /* Return the value of darwin_macosx_version_min suitable for the __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ macro, - so '10.4.2' becomes 1040. The lowest digit is always zero. - Print a warning if the version number can't be understood. */ + so '10.4.2' becomes 1040 and '10.10.0' becomes 101000. The lowest + digit is always zero. Print a warning if the version number + can't be understood. */ static const char * version_as_macro (void) { - static char result[] = "1000"; + static char result[7] = "1000"; + int minorDigitIdx; if (strncmp (darwin_macosx_version_min, "10.", 3) != 0) goto fail; if (! ISDIGIT (darwin_macosx_version_min[3])) goto fail; - result[2] = darwin_macosx_version_min[3]; - if (darwin_macosx_version_min[4] != '\0' - && darwin_macosx_version_min[4] != '.') + + minorDigitIdx = 3; + result[2] = darwin_macosx_version_min[minorDigitIdx++]; + if (ISDIGIT(darwin_macosx_version_min[minorDigitIdx])) { + /* Starting with 10.10 numeration for mactro changed */ + result[3] = darwin_macosx_version_min[minorDigitIdx++]; + result[4] = '0'; + result[5] = '0'; + result[6] = '\0'; + } + if (darwin_macosx_version_min[minorDigitIdx] != '\0' + && darwin_macosx_version_min[minorDigitIdx] != '.') goto fail; return result; diff --git a/gcc/config/darwin-driver.c b/gcc/config/darwin-driver.c index 8b6ae93..a115616 100644 --- a/gcc/config/darwin-driver.c +++ b/gcc/config/darwin-driver.c @@ -57,7 +57,7 @@ darwin_find_version_from_kernel (char *new_flag) version_p = osversion + 1; if (ISDIGIT (*version_p)) major_vers = major_vers * 10 + (*version_p++ - '0'); - if (major_vers > 4 + 9) + if (major_vers > 4 + 10) goto parse_failed; if (*version_p++ != '.') goto parse_failed; diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc index 196eb3b..aae2a13 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc @@ -835,8 +835,10 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type); COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent)); CHECK_SIZE_AND_OFFSET(dirent, d_ino); -#if SANITIZER_MAC +#if SANITIZER_MAC && ( !defined(__DARWIN_64_BIT_INO_T) || __DARWIN_64_BIT_INO_T) CHECK_SIZE_AND_OFFSET(dirent, d_seekoff); +#elif SANITIZER_MAC +// There is no d_seekoff with non 64-bit ino_t #else CHECK_SIZE_AND_OFFSET(dirent, d_off); #endif diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h index be6e6cf..3bda1eb 100644 --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h @@ -275,12 +275,20 @@ namespace __sanitizer { #endif #if SANITIZER_MAC +#if ! defined(__DARWIN_64_BIT_INO_T) || __ DARWIN_64_BIT_INO_T struct __sanitizer_dirent { unsigned long long d_ino; unsigned long long d_seekoff; unsigned short d_reclen; // more fields that we don't care about }; +#else + struct __sanitizer_dirent { + unsigned int d_ino; + unsigned short d_reclen; + // more fields that we don't care about + }; +#endif #elif SANITIZER_ANDROID || defined(__x86_64__) struct __sanitizer_dirent { unsigned long long d_ino;
external by Ivan 150 0 2 0
ubuntu 14.04 gcc = gcc-4.9
ubuntu 14.04 gcc = gcc-4.9:
gistfile1.txt
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get install g++-4.9 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9
external by Izaak Beekman 136 0 2 0
Patch gcc trunk to bootstrap on OS X. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78267 for more info. This is "untested patch 2"
Patch gcc trunk to bootstrap on OS X. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78267 for more info. This is "untested patch 2":
gcc-trunk-mac-bootstrap.patch
diff --git a/libsanitizer/sanitizer_common/sanitizer_mac.cc b/libsanitizer/sanitizer_common/sanitizer_mac.cc index 4408d1d..e495a10 100644 --- a/libsanitizer/sanitizer_common/sanitizer_mac.cc +++ b/libsanitizer/sanitizer_common/sanitizer_mac.cc @@ -34,7 +34,7 @@ extern char **environ; #endif -#if defined(__has_include) && __has_include(<os/trace.h>) +#if defined(__has_include) && __has_include(<os/trace.h>) && defined(__clang__) #define SANITIZER_OS_TRACE 1 #include <os/trace.h> #else @@ -49,7 +49,9 @@ extern "C" { } #endif +#if defined(__clang__) #include <asl.h> +#endif #include <dlfcn.h> // for dladdr() #include <errno.h> #include <fcntl.h> @@ -474,7 +476,7 @@ static BlockingMutex syslog_lock(LINKER_INITIALIZED); #endif void WriteOneLineToSyslog(const char *s) { -#if !SANITIZER_GO +#if !SANITIZER_GO && defined(__clang__) syslog_lock.CheckLocked(); asl_log(nullptr, nullptr, ASL_LEVEL_ERR, "%s", s); #endif