darwin: rename darwin-getproctitle.m

Rename it to darwin-getproctitle.c, it doesn't need an Objective-C
compiler. Fix up -Wpedantic warnings about void to function pointer
casts and include <ApplicationServices/ApplicationServices.h> to get
the GetCurrentProcess() function prototype.
This commit is contained in:
Ben Noordhuis 2013-05-02 13:59:18 +02:00
parent 4b0fac8990
commit 9b801d551b
3 changed files with 4 additions and 8 deletions

View File

@ -18,8 +18,6 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.
OBJC ?= $(CC)
E= E=
CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter CSTDFLAG=--std=c89 -pedantic -Wall -Wextra -Wno-unused-parameter
CFLAGS += -g CFLAGS += -g
@ -184,9 +182,6 @@ test/%.o: test/%.c include/uv.h test/.buildstamp
clean-platform: clean-platform:
$(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) src/unix/uv-dtrace.h $(RM) test/run-{tests,benchmarks}.dSYM $(OBJS) $(OBJS:%.o=%.pic.o) src/unix/uv-dtrace.h
%.pic.o %.o: %.m
$(OBJC) $(CPPFLAGS) $(CFLAGS) -c $^ -o $@
src/unix/uv-dtrace.h: src/unix/uv-dtrace.d src/unix/uv-dtrace.h: src/unix/uv-dtrace.d
dtrace -h -xnolibs -s $< -o $@ dtrace -h -xnolibs -s $< -o $@

View File

@ -19,6 +19,7 @@
*/ */
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
int uv__set_process_title(const char* title) { int uv__set_process_title(const char* title) {
@ -43,14 +44,14 @@ int uv__set_process_title(const char* title) {
if (launch_services_bundle == NULL) if (launch_services_bundle == NULL)
return -1; return -1;
ls_get_current_application_asn = ls_get_current_application_asn = (LSGetCurrentApplicationASNType)
CFBundleGetFunctionPointerForName(launch_services_bundle, CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSGetCurrentApplicationASN")); CFSTR("_LSGetCurrentApplicationASN"));
if (ls_get_current_application_asn == NULL) if (ls_get_current_application_asn == NULL)
return -1; return -1;
ls_set_application_information_item = ls_set_application_information_item = (LSSetApplicationInformationItemType)
CFBundleGetFunctionPointerForName(launch_services_bundle, CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSSetApplicationInformationItem")); CFSTR("_LSSetApplicationInformationItem"));

2
uv.gyp
View File

@ -176,7 +176,7 @@
'sources': [ 'sources': [
'src/unix/darwin.c', 'src/unix/darwin.c',
'src/unix/fsevents.c', 'src/unix/fsevents.c',
'src/unix/darwin-proctitle.m', 'src/unix/darwin-proctitle.c',
], ],
'link_settings': { 'link_settings': {
'libraries': [ 'libraries': [