Skip to content

Commit

Permalink
Merge pull request #140 from SpamapS/fix-macos
Browse files Browse the repository at this point in the history
Start trying to support Mac OS X
  • Loading branch information
p-alik authored Dec 11, 2017
2 parents d40e6cc + 97e714f commit e2d76cf
Show file tree
Hide file tree
Showing 28 changed files with 83 additions and 202 deletions.
15 changes: 4 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
os:
- linux
- osx
language: cpp
dist: trusty
sudo: required
Expand Down Expand Up @@ -26,17 +29,7 @@ matrix:
env: COMPILER=g++-5

before_install:
- sudo apt-get update -qq
- if [ "$COMPILER" = "g++-4.9" ]; then sudo apt-get install -qq g++-4.9; fi
- if [ "$COMPILER" = "g++-4.9" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
- if [ "$COMPILER" = "g++-5" ]; then sudo apt-get install -qq g++-5; fi
- if [ "$COMPILER" = "g++-5" ]; then export CXX="g++-5" CC="gcc-5"; fi
- sudo apt-get install -y libboost-all-dev
- sudo apt-get install -y gperf
- sudo apt-get install -y libevent-dev
- sudo apt-get install -y uuid-dev
- sudo apt-get install -y python-sphinx
- sudo apt-get install -y libhiredis-dev
- . scripts/travis-$TRAVIS_OS_NAME.sh

script:
- ./bootstrap.sh -a
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ AC_CHECK_HEADERS_ONCE([syslog.h])
AC_CHECK_HEADERS_ONCE([unistd.h])
AC_CHECK_HEADERS_ONCE([winsock2.h])
AC_CHECK_HEADERS_ONCE([libmemcached-1.0/types/return.h])
AC_CHECK_DECL([htonll],[AC_DEFINE([HAVE_HTONLL],[1],
[Define to 1 if you have htonll.])])

AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
Expand Down
76 changes: 0 additions & 76 deletions libgearman-server/byteorder.cc

This file was deleted.

67 changes: 0 additions & 67 deletions libgearman-server/byteorder.h

This file was deleted.

1 change: 0 additions & 1 deletion libgearman-server/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#pragma once

#include <libgearman-server/gearmand.h>
#include <libgearman-server/byteorder.h>
#include "libgearman-server/config.hpp"

#include "libgearman/assert.hpp"
Expand Down
1 change: 0 additions & 1 deletion libgearman-server/gearmand.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

#include <libgearman-server/constants.h>
#include <libgearman-server/wakeup.h>
#include <libgearman-server/byteorder.h>
#include <libgearman-server/log.h>
#include <libgearman-server/packet.h>
#include <libgearman-server/connection.h>
Expand Down
2 changes: 0 additions & 2 deletions libgearman-server/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ noinst_HEADERS+= libgearman-server/queue.hpp
noinst_HEADERS+= libgearman-server/text.h
noinst_HEADERS+= \
libgearman-server/byte.h \
libgearman-server/byteorder.h \
libgearman-server/client.h \
libgearman-server/common.h \
libgearman-server/config.h \
Expand Down Expand Up @@ -61,7 +60,6 @@ libgearman_server_libgearman_server_la_SOURCES+= libgearman/vector.cc
libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/text.cc
libgearman_server_libgearman_server_la_SOURCES+= libgearman-server/config.cc
libgearman_server_libgearman_server_la_SOURCES+= \
libgearman-server/byteorder.cc \
libgearman-server/client.cc \
libgearman-server/connection.cc \
libgearman-server/function.cc \
Expand Down
2 changes: 1 addition & 1 deletion libgearman-server/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ gearmand_error_t gearman_server_run_command(gearman_server_con_st *server_con,
server_job->data, server_job->data_size,
NULL);
}
else if (packet->command == GEARMAN_COMMAND_GRAB_JOB_ALL and server_job->reducer)
else if (packet->command == GEARMAN_COMMAND_GRAB_JOB_ALL and *server_job->reducer != '\0')
{
gearmand_log_debug(GEARMAN_DEFAULT_LOG_PARAM,
"Sending reduce submission, Partitioner: %.*s(%lu) Reducer: %.*s(%lu) Unique: %.*s(%lu) with data sized (%lu)" ,
Expand Down
4 changes: 4 additions & 0 deletions libgearman/byteorder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ static inline uint64_t swap64(uint64_t in)
}
#endif

#ifndef HAVE_HTONLL

uint64_t ntohll(uint64_t value)
{
return swap64(value);
Expand All @@ -74,3 +76,5 @@ uint64_t htonll(uint64_t value)
{
return swap64(value);
}

#endif
10 changes: 0 additions & 10 deletions libgearman/byteorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@

#pragma once

#ifndef HAVE_HTONLL

GEARMAN_INTERNAL_API
uint64_t ntohll(uint64_t);

GEARMAN_INTERNAL_API
uint64_t htonll(uint64_t);

#endif

#ifdef linux
/* /usr/include/netinet/in.h defines macros from ntohs() to _bswap_nn to
* optimize the conversion functions, but the prototypes generate warnings
Expand Down
10 changes: 9 additions & 1 deletion libgearman/command.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@
#include <libgearman/common.h>

#include <libgearman-1.0/visibility.h>
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-register"
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
#include "libgearman/command.hpp"
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#include "libgearman/strcommand.h"

#include "libgearman/assert.hpp"
Expand Down Expand Up @@ -133,7 +141,7 @@ const gearman_command_info_st *gearman_command_info(gearman_command_t command)
return command_info;
}

const struct gearman_command_info_st * gearman_command_lookup (register const char *str, register unsigned int len)
const struct gearman_command_info_st * gearman_command_lookup (const char *str, unsigned int len)
{
const struct gearman_command_string_st* com_str= String2gearman_command_t::in_word_set(str, len);
return gearman_command_info(com_str->code);
Expand Down
2 changes: 1 addition & 1 deletion libgearman/command.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const char *gearman_enum_strcommand(gearman_command_t);

const struct gearman_command_info_st *gearman_command_info(gearman_command_t command);

const struct gearman_command_info_st * gearman_command_lookup (register const char *str, register unsigned int len);
const struct gearman_command_info_st * gearman_command_lookup (const char *str, unsigned int len);

#ifdef __cplusplus
}
Expand Down
1 change: 0 additions & 1 deletion libgearman/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ struct gearman_universal_st;
#include "libgearman/error_code.h"

/* These are private not to be installed headers */
#include "libgearman/byteorder.h"
#include "libgearman/strcommand.h"
#include "libgearman/vector.hpp"
#include "libgearman/unique.hpp"
Expand Down
8 changes: 8 additions & 0 deletions libgearman/error_code.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@
#include "gear_config.h"

#include "libgearman/error_code.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-register"
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
#endif
#include "libgearman/error_code.hpp"
#ifdef __clang__
#pragma clang diagnostic pop
#endif

#include "libgearman-1.0/visibility.h"
#include "libgearman-1.0/strerror.h"
Expand Down
2 changes: 0 additions & 2 deletions libgearman/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ noinst_HEADERS+= \
libgearman/allocator.hpp \
libgearman/assert.hpp \
libgearman/backtrace.hpp \
libgearman/byteorder.h \
libgearman/command.h \
libgearman/common.h \
libgearman/connection.hpp \
Expand Down Expand Up @@ -99,7 +98,6 @@ libgearman_libgearman_la_SOURCES+= \
libgearman/argument.cc \
libgearman/add.cc \
libgearman/backtrace.cc \
libgearman/byteorder.cc \
libgearman/client.cc \
libgearman/command.cc \
libgearman/connection.cc \
Expand Down
8 changes: 0 additions & 8 deletions libgearman/job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,14 +318,6 @@ gearman_client_st *gearman_job_use_client(gearman_job_st *job_shell)
return NULL;
}

static inline void gearman_job_reset_error(Job* job)
{
if (job)
{
gearman_worker_reset_error(job->_worker);
}
}

gearman_return_t gearman_job_send_data(gearman_job_st *job_shell, const void *data, size_t data_size)
{
if (job_shell and job_shell->impl())
Expand Down
1 change: 0 additions & 1 deletion libgearmancore/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ noinst_LTLIBRARIES+= libgearman/libgearmancore.la
libgearman_libgearmancore_la_SOURCES=
libgearman_libgearmancore_la_SOURCES+= libgearman/allocator.cc
libgearman_libgearmancore_la_SOURCES+= libgearman/backtrace.cc
libgearman_libgearmancore_la_SOURCES+= libgearman/byteorder.cc
libgearman_libgearmancore_la_SOURCES+= libgearman/check.cc
libgearman_libgearmancore_la_SOURCES+= libgearman/command.cc
libgearman_libgearmancore_la_SOURCES+= libgearman/connection.cc
Expand Down
2 changes: 1 addition & 1 deletion libtest/exception/disconnected.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace libtest {
class disconnected : public libtest::exception
{
public:
disconnected(const char *file, int line, const char *func, const std::string&, const in_port_t port, ...);
disconnected(const char *file, int line, const char *func, const std::string&, const int port, ...);

disconnected(const disconnected&);

Expand Down
2 changes: 1 addition & 1 deletion libtest/exception/fatal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void fatal::increment_disabled_counter() throw()

#pragma GCC diagnostic ignored "-Wformat-nonliteral"
disconnected::disconnected(const char *file_arg, int line_arg, const char *func_arg,
const std::string& instance, const in_port_t port, ...) :
const std::string& instance, const int port, ...) :
libtest::exception(file_arg, line_arg, func_arg),
_port(port)
{
Expand Down
6 changes: 0 additions & 6 deletions libtest/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@
#include <locale>
#include <unistd.h>

// trim from end
static inline std::string &rtrim(std::string &s)
{
s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun<int, int>(std::isspace))).base(), s.end());
return s;
}

#include <libtest/server.h>
#include <libtest/stream.h>
Expand Down
Loading

0 comments on commit e2d76cf

Please sign in to comment.