Skip to content

Commit

Permalink
Merge pull request #4304 from BOINC/mac_C++11_fixes
Browse files Browse the repository at this point in the history
Mac: Fix Mac builds to support C++11
  • Loading branch information
AenBleidd authored and Charlie Fenton committed Jun 2, 2021
1 parent 8ebfa90 commit 8635cd1
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 17 deletions.
2 changes: 1 addition & 1 deletion client/dhrystone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int dhrystone(
double benchtime;
double Dhrystones_Per_Second;

register unsigned long Run_Index;
REG unsigned long Run_Index;


Next_Ptr_Glob = (Rec_Pointer) malloc (sizeof (Rec_Type));
Expand Down
4 changes: 4 additions & 0 deletions client/dhrystone.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

#ifdef __APPLE__
#define REG
#else
#define REG register
#endif

typedef enum {Ident_1, Ident_2, Ident_3, Ident_4, Ident_5} Enumeration;

Expand Down
10 changes: 5 additions & 5 deletions clientgui/mac/MacAccessiblity.mm
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute {
return [NSNumber numberWithBool:YES];

} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO;
return [NSNumber numberWithBool:NO];

} else if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
return NSAccessibilityStaticTextRole;
Expand Down Expand Up @@ -626,7 +626,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute {
return [NSNumber numberWithBool:YES];

} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO;
return [NSNumber numberWithBool:NO];

} else if ([attribute isEqualToString:NSAccessibilityParentAttribute]) {
return NSAccessibilityUnignoredAncestor(parent);
Expand Down Expand Up @@ -926,7 +926,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute {
return NSAccessibilityRoleDescription(NSAccessibilityListRole, nil);

} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO;
return [NSNumber numberWithBool:NO];

} else if ([attribute isEqualToString:NSAccessibilityParentAttribute]) {
return NSAccessibilityUnignoredAncestor(parent);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute {
return NSAccessibilityRoleDescription(NSAccessibilityGroupRole, nil);

} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO;
return [NSNumber numberWithBool:NO];

} else if ([attribute isEqualToString:NSAccessibilityParentAttribute]) {
return NSAccessibilityUnignoredAncestor(parent);
Expand Down Expand Up @@ -1540,7 +1540,7 @@ - (id)accessibilityAttributeValue:(NSString *)attribute {
return [NSNumber numberWithBool:YES];

} else if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) {
return NO;
return [NSNumber numberWithBool:NO];

} else if ([attribute isEqualToString:NSAccessibilityNumberOfCharactersAttribute]) {
NSString *s = [self getValue];
Expand Down
6 changes: 3 additions & 3 deletions clientgui/sg_PanelBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ void CSimplePanelBase::MakeBGBitMap() {
wxBitmap whiteBmp;
wxImage bgImage;
wxImage whiteImage;
register unsigned char *bgImagePixels;
register unsigned char *whitePixels;
register int i, j, k;
unsigned char *bgImagePixels;
unsigned char *whitePixels;
int i, j, k;
CSimpleGUIPanel* backgroundPanel = (CSimpleGUIPanel*)GetParent();
wxPen bgPen(*wxWHITE, 1, wxTRANSPARENT);
wxBrush bgBrush(*wxWHITE);
Expand Down
1 change: 1 addition & 0 deletions clientscr/Mac_Saver_Module.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// The declarations below must be kept in sync with
// the corresponding ones in Mac_Saver_ModuleView.h
#ifdef _DEBUG
#undef _T
#define _T(x) x
#endif

Expand Down
2 changes: 1 addition & 1 deletion clientscr/mac_saver_module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ CScreensaver::CScreensaver() {
m_iGraphicsStartingMsgCounter = 0;
saverState = SaverState_Idle;
m_wasAlreadyRunning = false;
m_CoreClientPID = nil;
m_CoreClientPID = 0;
setSSMessageText(0);
m_CurrentBannerMessage = 0;
m_bQuitDataManagementProc = false;
Expand Down
12 changes: 5 additions & 7 deletions mac_build/BuildMacBOINC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# Updated 10/17/17 to fix bug when -all argument is implied but not explicitly passed
# Updated 10/19/17 Special handling of screensaver build is no longer needed
# Updated 10/14/18 for Xcode 10 (use this script only with BOINC 7.15 or later)
# Updated 3/31/21 To eliminate redundant -c++11 arg since C++11 build is now standard
#
## This script requires OS 10.8 or later
#
Expand All @@ -46,10 +47,10 @@
## cd [path]/boinc/mac_build
##
## then invoke this script as follows:
## source BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-c++11] [-all] [-lib] [-client] [-target targetName] [-setting name value] [-help]
## source BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-all] [-lib] [-client] [-target targetName] [-setting name value] [-help]
## or
## chmod +x BuildMacBOINC.sh
## ./BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-c++11] [-all] [-lib] [-client] [-target targetName] [-setting name value] [-help]
## ./BuildMacBOINC.sh [-dev] [-noclean] [-libstdc++] [-all] [-lib] [-client] [-target targetName] [-setting name value] [-help]
##
## optional arguments
## -dev build the development (debug) version.
Expand All @@ -60,7 +61,6 @@
##
## -libstdc++ build using libstdc++ instead of libc++
##
## -c++11 build using c++11 language dialect instead of default (incompatible with libstdc++)
##
## The following arguments determine which targets to build
##
Expand All @@ -84,7 +84,6 @@

targets=""
doclean="clean"
cplusplus11dialect=""
uselibcplusplus=""
buildall=0
buildlibs=0
Expand All @@ -98,7 +97,6 @@ while [ $# -gt 0 ]; do
-noclean ) doclean="" ; shift 1 ;;
-dev ) style="Development" ; shift 1 ;;
-libstdc++ ) uselibcplusplus="CLANG_CXX_LIBRARY=libstdc++" ; shift 1 ;;
-c++11 ) cplusplus11dialect="CLANG_CXX_LANGUAGE_STANDARD=c++11" ; shift 1 ;;
-all ) buildall=1 ; shift 1 ;;
-lib ) buildlibs=1 ; shift 1 ;;
-client ) buildclient=1 ; shift 1 ;;
Expand Down Expand Up @@ -163,15 +161,15 @@ echo ""
SDKPATH=`xcodebuild -version -sdk macosx Path`
result=0

xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ${uselibcplusplus} ${cplusplus11dialect} "${settings[@]}"
xcodebuild -project boinc.xcodeproj ${targets} -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ${uselibcplusplus} "${settings[@]}"
result=$?

if [ $result -eq 0 ]; then
# build ibboinc_zip.a for -all or -lib or default, where
# default is none of { -all, -lib, -client }
if [ "${buildall}" = "1" ] || [ "${buildlibs}" = "1" ] || [ "${buildclient}" = "0" ]; then
if [ "${buildzip}" = "1" ]; then
xcodebuild -project ../zip/boinc_zip.xcodeproj -target boinc_zip -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ${uselibcplusplus} ${cplusplus11dialect}
xcodebuild -project ../zip/boinc_zip.xcodeproj -target boinc_zip -configuration ${style} -sdk "${SDKPATH}" ${doclean} build ${uselibcplusplus}
result=$?
fi
fi
Expand Down
2 changes: 2 additions & 0 deletions mac_build/boinc.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4417,6 +4417,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COPY_PHASE_STRIP = YES;
DEAD_CODE_STRIPPING = YES;
Expand Down Expand Up @@ -4591,6 +4592,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
Expand Down

0 comments on commit 8635cd1

Please sign in to comment.