summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-18 01:05:12 +0000
committercyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864>2009-11-18 01:05:12 +0000
commitda8a1c7b6068dcc079d6f710a877ed53fabff86f (patch)
tree599684a3661fa346705d768568bf1e5d5b71f770
parente10fe1cd767cf479837eecc1e1b26615d63ea5ac (diff)
Remove some CoreExports and add them in other places, fixed a few minor warnings under Windows build, made Windows build create a static library out of win32_memory.cpp and use that with everything instead of relying on it being compiled into everything (saves compiling time).
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2656 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--include/account.h2
-rw-r--r--include/hashcomp.h14
-rw-r--r--include/modules.h2
-rw-r--r--include/services.h44
-rw-r--r--src/CMakeLists.txt17
-rw-r--r--src/commands.c1
-rw-r--r--src/core/CMakeLists.txt9
-rw-r--r--src/mail.c1
-rw-r--r--src/modules.c4
-rw-r--r--src/modules/CMakeLists.txt18
-rw-r--r--src/protocol/CMakeLists.txt9
-rw-r--r--src/users.c2
-rw-r--r--src/wildcard.cpp2
13 files changed, 65 insertions, 60 deletions
diff --git a/include/account.h b/include/account.h
index b2ba04950..e20b70fe4 100644
--- a/include/account.h
+++ b/include/account.h
@@ -66,7 +66,7 @@ enum NickCoreFlag
/** XXX: this really needs to die with fire and be merged with metadata into NickCore or something.
*/
-class NickRequest
+class CoreExport NickRequest
{
public:
NickRequest(const std::string &nickname);
diff --git a/include/hashcomp.h b/include/hashcomp.h
index 4fb7e5a20..df382090b 100644
--- a/include/hashcomp.h
+++ b/include/hashcomp.h
@@ -113,7 +113,7 @@ namespace irc
* @return similar to strcmp, zero for equal, less than zero for str1
* being less and greater than zero for str1 being greater than str2.
*/
- static CoreExport int compare(const char *str1, const char *str2, size_t n);
+ static int compare(const char *str1, const char *str2, size_t n);
/** Find a char within a string up to position n.
* @param s1 String to find in
@@ -121,7 +121,7 @@ namespace irc
* @param c Character to search for
* @return Pointer to the first occurance of c in s1
*/
- static CoreExport const char *find(const char *s1, int n, char c);
+ static const char *find(const char *s1, int n, char c);
};
/** This typedef declares irc::string based upon irc_char_traits.
@@ -137,7 +137,7 @@ namespace ci
* This class is used to implement ci::string, a case-insensitive, ASCII-
* comparing string class.
*/
- struct ci_char_traits : std::char_traits<char>
+ struct CoreExport ci_char_traits : std::char_traits<char>
{
/** Check if two chars match.
* @param c1st First character
@@ -167,7 +167,7 @@ namespace ci
* @return similar to strcmp, zero for equal, less than zero for str1
* being less and greater than zero for str1 being greater than str2.
*/
- static CoreExport int compare(const char *str1, const char *str2, size_t n);
+ static int compare(const char *str1, const char *str2, size_t n);
/** Find a char within a string up to position n.
* @param s1 String to find in
@@ -175,7 +175,7 @@ namespace ci
* @param c Character to search for
* @return Pointer to the first occurance of c in s1
*/
- static CoreExport const char *find(const char *s1, int n, char c);
+ static const char *find(const char *s1, int n, char c);
};
/** This typedef declares ci::string based upon ci_char_traits.
@@ -449,7 +449,7 @@ class CoreExport sepstream
/** A derived form of sepstream, which seperates on commas
*/
-class CoreExport commasepstream : public sepstream
+class commasepstream : public sepstream
{
public:
/** Initialize with comma seperator
@@ -461,7 +461,7 @@ class CoreExport commasepstream : public sepstream
/** A derived form of sepstream, which seperates on spaces
*/
-class CoreExport spacesepstream : public sepstream
+class spacesepstream : public sepstream
{
public:
/** Initialize with space seperator
diff --git a/include/modules.h b/include/modules.h
index 87b50a541..cfa639d08 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -276,7 +276,7 @@ class CoreExport Command : public Flags<CommandFlag>
Command *next;
};
-class CoreExport Version
+class Version
{
private:
unsigned Major;
diff --git a/include/services.h b/include/services.h
index 79ba6482d..110da397b 100644
--- a/include/services.h
+++ b/include/services.h
@@ -245,7 +245,7 @@ extern int strncasecmp(const char *, const char *, size_t);
* be loaded. If this happens, the error message returned by ModuleException::GetReason will be displayed to the user
* attempting to load the module, or dumped to the console if the ircd is currently loading for the first time.
*/
-class CoreExport CoreException : public std::exception
+class CoreException : public std::exception
{
protected:
/** Holds the error message to be displayed
@@ -284,7 +284,7 @@ class CoreExport CoreException : public std::exception
}
};
-class CoreExport ModuleException : public CoreException
+class ModuleException : public CoreException
{
public:
/** Default constructor, just uses the error mesage 'Module threw an exception'.
@@ -421,7 +421,7 @@ class CoreExport Extensible
/** Class with the ability to keep flags on items, they should extend from this
* where T is an enum.
*/
-template<typename T> class CoreExport Flags
+template<typename T> class Flags
{
protected:
std::bitset<128> Flag_Values;
@@ -474,7 +474,7 @@ template<typename T> class CoreExport Flags
class User;
class ChannelInfo;
class Channel;
-class EList;
+struct EList;
typedef struct bandata_ BanData;
typedef struct userdata_ UserData;
@@ -644,7 +644,7 @@ enum MemoFlag
/* Memo info structures. Since both nicknames and channels can have memos,
* we encapsulate memo data in a MemoList to make it easier to handle. */
-class CoreExport Memo : public Flags<MemoFlag>
+class Memo : public Flags<MemoFlag>
{
public:
uint32 number; /* Index number -- not necessarily array position! */
@@ -716,7 +716,7 @@ enum AutoKickFlag
};
/* AutoKick data. */
-class CoreExport AutoKick : public Flags<AutoKickFlag>
+class AutoKick : public Flags<AutoKickFlag>
{
public:
/* Only one of these can be in use */
@@ -872,7 +872,7 @@ enum ServerFlag
SERVER_END
};
-class CoreExport Server : public Flags<ServerFlag>
+class Server : public Flags<ServerFlag>
{
public:
Server *next, *prev;
@@ -1069,7 +1069,7 @@ enum EntryType
ENTRYTYPE_HOST
};
-class CoreExport Entry : public Flags<EntryType>
+class Entry : public Flags<EntryType>
{
public:
Entry *next, *prev;
@@ -1231,7 +1231,7 @@ class UserMode
/** This class is a channel mode, all channel modes use this/inherit from this
*/
-class ChannelMode
+class CoreExport ChannelMode
{
public:
@@ -1264,7 +1264,7 @@ class ChannelMode
/** This is a mode for lists, eg b/e/I. These modes should inherit from this
*/
-class ChannelModeList : public ChannelMode
+class CoreExport ChannelModeList : public ChannelMode
{
public:
@@ -1302,7 +1302,7 @@ class ChannelModeList : public ChannelMode
/** This is a mode with a paramater, eg +k/l. These modes should use/inherit from this
*/
-class ChannelModeParam : public ChannelMode
+class CoreExport ChannelModeParam : public ChannelMode
{
public:
@@ -1332,7 +1332,7 @@ class ChannelModeParam : public ChannelMode
/** This is a mode that is a channel status, eg +v/h/o/a/q.
*/
-class ChannelModeStatus : public ChannelMode
+class CoreExport ChannelModeStatus : public ChannelMode
{
public:
/** CUS_ values, see below
@@ -1427,7 +1427,7 @@ class CoreExport ModeManager
/** Channel mode +b
*/
-class ChannelModeBan : public ChannelModeList
+class CoreExport ChannelModeBan : public ChannelModeList
{
public:
ChannelModeBan() : ChannelModeList(CMODE_BAN) { }
@@ -1439,7 +1439,7 @@ class ChannelModeBan : public ChannelModeList
/** Channel mode +e
*/
-class ChannelModeExcept : public ChannelModeList
+class CoreExport ChannelModeExcept : public ChannelModeList
{
public:
ChannelModeExcept() : ChannelModeList(CMODE_EXCEPT) { }
@@ -1451,7 +1451,7 @@ class ChannelModeExcept : public ChannelModeList
/** Channel mode +I
*/
-class ChannelModeInvite : public ChannelModeList
+class CoreExport ChannelModeInvite : public ChannelModeList
{
public:
ChannelModeInvite() : ChannelModeList(CMODE_INVITEOVERRIDE) { }
@@ -1463,7 +1463,7 @@ class ChannelModeInvite : public ChannelModeList
/** Channel mode +k (key)
*/
-class ChannelModeKey : public ChannelModeParam
+class CoreExport ChannelModeKey : public ChannelModeParam
{
public:
ChannelModeKey() : ChannelModeParam(CMODE_KEY) { }
@@ -1484,7 +1484,7 @@ class ChannelModeFlood : public ChannelModeParam
/** This class is used for channel mode +A (Admin only)
* Only opers can mlock it
*/
-class ChannelModeAdmin : public ChannelMode
+class CoreExport ChannelModeAdmin : public ChannelMode
{
public:
ChannelModeAdmin() : ChannelMode(CMODE_ADMINONLY) { }
@@ -1496,7 +1496,7 @@ class ChannelModeAdmin : public ChannelMode
/** This class is used for channel mode +O (Opers only)
* Only opers can mlock it
*/
-class ChannelModeOper : public ChannelMode
+class CoreExport ChannelModeOper : public ChannelMode
{
public:
ChannelModeOper() : ChannelMode(CMODE_OPERONLY) { }
@@ -1508,7 +1508,7 @@ class ChannelModeOper : public ChannelMode
/** This class is used for channel mode +r (registered channel)
* No one may mlock r
*/
-class ChannelModeRegistered : public ChannelMode
+class CoreExport ChannelModeRegistered : public ChannelMode
{
public:
ChannelModeRegistered() : ChannelMode(CMODE_REGISTERED) { }
@@ -1741,7 +1741,7 @@ class CoreExport IRCDProto
virtual void SetAutoIdentificationToken(User *u) { }
};
-class CoreExport IRCDTS6Proto : public IRCDProto
+class IRCDTS6Proto : public IRCDProto
{
};
@@ -1764,7 +1764,7 @@ struct Uplink {
}
};
-class Anope
+class CoreExport Anope
{
public:
/** Check whether two strings match.
@@ -1772,7 +1772,7 @@ class Anope
* @param str The string to check against the pattern (e.g. foobar)
* @param case_sensitive Whether or not the match is case sensitive, default false.
*/
- CoreExport static bool Match(const std::string &str, const std::string &mask, bool case_sensitive = false);
+ static bool Match(const std::string &str, const std::string &mask, bool case_sensitive = false);
};
/*************************************************************************/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9641a4ad2..a6343e8c3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -2,10 +2,8 @@
file(GLOB SRC_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
file(GLOB SRC_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp")
set(SRC_SRCS ${SRC_SRCS_C} ${SRC_SRCS_CPP})
-# If not using Visual Studio, don't include win32_memory.cpp, it's only required by Visual Studio to override it's override of the new/delete operators
-if(NOT MSVC)
- remove_item_from_list(SRC_SRCS win32_memory.cpp)
-endif(NOT MSVC)
+# Don't include win32_memory.cpp, it's only required by Visual Studio to override it's override of the new/delete operators
+remove_item_from_list(SRC_SRCS win32_memory.cpp)
# If not using Windows, don't include windows.cpp, as it's Windows-specific
if(NOT WIN32)
remove_item_from_list(SRC_SRCS windows.cpp)
@@ -54,12 +52,21 @@ if(WIN32)
endif(MINGW)
endif(WIN32)
+# If compiling with Visual Studio, create a static library out of win32_memory.cpp to be included with everything else, needed to override it's override of new/delete operators
+if(MSVC)
+ set_source_files_properties(win32_memory.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
+ add_library(win32_memory STATIC win32_memory.cpp)
+ set(WIN32_MEMORY win32_memory)
+else(MSVC)
+ set(WIN32_MEMORY)
+endif(MSVC)
+
# Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module
add_executable(${PROGRAM_NAME} ${SRC_SRCS})
set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}" ENABLE_EXPORTS ON)
# On Windows, also link Anope to the wsock32 library, as well as set the version
if(WIN32)
- target_link_libraries(${PROGRAM_NAME} wsock32)
+ target_link_libraries(${PROGRAM_NAME} wsock32 ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Building the Anope executable requires the language files to be compiled first as well as the version.h header to be generated
diff --git a/src/commands.c b/src/commands.c
index 6398a9b76..22e9fb8de 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -35,7 +35,6 @@ Command *lookup_cmd(Command * list, char *cmd)
return c;
}
}
- return NULL;
}
/*************************************************************************/
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 7aa474743..f8547872b 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -27,10 +27,11 @@ foreach(SRC ${CORE_SRCS})
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
endif(TEMP_INCLUDES)
- # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
+ # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
- append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
- set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
+ set(WIN32_MEMORY win32_memory)
+ else(MSVC)
+ set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${SRC})
@@ -38,7 +39,7 @@ foreach(SRC ${CORE_SRCS})
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
- target_link_libraries(${SO} ${PROGRAM_NAME} wsock32)
+ target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
diff --git a/src/mail.c b/src/mail.c
index ea8ef65f6..e9d137bf9 100644
--- a/src/mail.c
+++ b/src/mail.c
@@ -164,7 +164,6 @@ MailInfo *MailMemoBegin(NickCore * nc)
getstring(MEMO_MAIL_SUBJECT));
return mail;
}
- return NULL;
}
/*************************************************************************/
diff --git a/src/modules.c b/src/modules.c
index 3482220ae..6a65da2eb 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -549,8 +549,6 @@ int delMessage(MessageHash * msgTable[], Message * m)
current->m = tail->next;
}
return MOD_ERR_OK;
- last = tail;
- tail = tail->next;
}
} else {
msgTable[index] = current->next;
@@ -567,8 +565,6 @@ int delMessage(MessageHash * msgTable[], Message * m)
current->m = tail->next;
}
return MOD_ERR_OK;
- last = tail;
- tail = tail->next;
}
} else {
lastHash->next = current->next;
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
index dbf9bbc97..79312cb8a 100644
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -33,10 +33,11 @@ foreach(SRC ${MODULES_SRCS})
set(TEMP_DEPENDENCIES)
# Calculate the library dependencies for the given source file
calculate_libraries(${SRC} TEMP_LDFLAGS TEMP_DEPENDENCIES)
- # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
+ # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
- append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
- set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
+ set(WIN32_MEMORY win32_memory)
+ else(MSVC)
+ set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${SRC})
@@ -44,7 +45,7 @@ foreach(SRC ${MODULES_SRCS})
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
- target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${TEMP_DEPENDENCIES})
+ target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${TEMP_DEPENDENCIES})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
@@ -113,10 +114,11 @@ foreach(FILE ${MODULES_FILES})
remove_list_duplicates(SUBDIR_EXTRA_DEPENDS)
endif(SUBDIR_EXTRA_DEPENDS)
- # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
+ # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
- append_to_list(MODULE_SUBDIR_SRCS ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
- set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
+ set(WIN32_MEMORY win32_memory)
+ else(MSVC)
+ set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
@@ -125,7 +127,7 @@ foreach(FILE ${MODULES_FILES})
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
- target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${SUBDIR_EXTRA_DEPENDS})
+ target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${SUBDIR_EXTRA_DEPENDS})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt
index fda2a9d90..a74b49a89 100644
--- a/src/protocol/CMakeLists.txt
+++ b/src/protocol/CMakeLists.txt
@@ -27,10 +27,11 @@ foreach(SRC ${PROTOCOL_SRCS})
if(TEMP_INCLUDES)
append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES})
endif(TEMP_INCLUDES)
- # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators
+ # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators
if(MSVC)
- append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp)
- set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}")
+ set(WIN32_MEMORY win32_memory)
+ else(MSVC)
+ set(WIN32_MEMORY)
endif(MSVC)
# Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand
add_library(${SO} MODULE ${SRC})
@@ -38,7 +39,7 @@ foreach(SRC ${PROTOCOL_SRCS})
add_dependencies(${SO} ${PROGRAM_NAME})
# For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version
if(WIN32)
- target_link_libraries(${SO} ${PROGRAM_NAME} wsock32)
+ target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY})
set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}")
endif(WIN32)
# Set the module to be installed to the module directory under the data directory
diff --git a/src/users.c b/src/users.c
index a54506f8c..bfc6131bf 100644
--- a/src/users.c
+++ b/src/users.c
@@ -341,7 +341,7 @@ void User::SendMessage(const char *source, const std::string &msg)
*/
void User::CheckAuthenticationToken(const char *svid)
{
- const char *c;
+ const char *c = NULL;
NickAlias *na;
if ((na = findnick(this->nick)))
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 59f2cc8e7..1106a9cd6 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -75,7 +75,7 @@ static bool match_internal(const unsigned char *str, const unsigned char *mask,
return !*wild;
}
-CoreExport bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive)
+bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive)
{
return match_internal(reinterpret_cast<const unsigned char *>(str.c_str()), reinterpret_cast<const unsigned char *>(mask.c_str()), case_sensitive);
}