From: Kevin Koch Date: Thu, 13 Mar 2008 19:30:49 +0000 (+0000) Subject: Include .h files and move all declarations above all code, for Windows C compilation X-Git-Tag: krb5-1.7-alpha1~711 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dc59494a80205bec93b5739a84f4a4acdc76996d;p=krb5.git Include .h files and move all declarations above all code, for Windows C compilation Update makefiles to include new modules. TargetVersion: 1.7 Component: krb5-libs Ticket: 5594 Tags: pullup Subj: Work on compiling the CCAPI test suite on Windows. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20275 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/ccapi/lib/win/Makefile b/src/ccapi/lib/win/Makefile deleted file mode 100644 index 4bdd98df7..000000000 --- a/src/ccapi/lib/win/Makefile +++ /dev/null @@ -1,116 +0,0 @@ -!include - -# . is ...\pismere\athena\auth\krb5\src\ccapi\lib\win -CCAPI = ..\.. -CO = $(CCAPI)\common -COWIN = $(CCAPI)\common\win -CCUTIL = $(CCAPI)\common\win\OldCC -LIBDIR = $(CCAPI)\lib -LIBWIN = $(LIBDIR)\win -K5SRC = $(CCAPI)\.. -POSIX = $(K5SRC)\lib\krb5\posix -OLDCC = $(LIBWIN)\OldCC - -INC = -I.. -I$(CO) -I$(COWIN) -I$(K5SRC)\include -I..\..\..\util\et -I$(OLDCC) \ - -I$(LIBWIN) -I$(CCUTIL) -MIDLI = /I $(K5SRC)\include /I. /I$(COWIN) /I$(CO) - -!if "$(CPU)" == "i386" -cflags = $(cflags) /EHsc /MDd -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 \ -$(INC) -D_CRT_SECURE_NO_WARNINGS -!else -cflags = $(cflags) /W3 -D_CRTAPI1= -D_CRTAPI2= $(INC) -!endif - -!if "$(PREPROCESS)" == "P" -cflags = $(cflags) -P -!endif - -all : ccapi.dll - -common = cci_array_internal.obj cci_cred_union.obj cci_debugging.obj cci_identifier.obj \ - cci_message.obj cci_stream.obj - -commonwin = cci_os_debugging.obj \ - cci_os_identifier.obj \ - tls.obj \ - win-utils.obj - -dll = ccapi_ccache.obj \ - ccapi_ccache_iterator.obj \ - ccapi_context.obj \ - ccapi_context_change_time.obj \ - ccapi_credentials.obj \ - ccapi_credentials_iterator.obj \ - ccapi_ipc.obj \ - ccapi_string.obj - -dllwin = ccs_reply_s.obj \ - ccs_reply_proc.obj \ - ccs_request_c.obj - -dllwincxx = ccapi_os_ipc.obj \ - dllmain.obj - -oldcc = client.obj \ - rpc.obj - -utils = ccutils.obj - -utilscxx = init.obj \ - secure.obj \ - util.obj - - -linkobjs = $(common) $(commonwin) $(dll) $(dllwin) $(dllwincxx) $(oldcc) $(utils) $(utilscxx) - -#includes = - -# Main program: -ccapi.dll : $(linkobjs) ccapi.def - $(link) $(linkdebug) $(conflags) -out:ccapi.dll /DEF:ccapi.def /implib:ccapi.lib $(dlllflags) \ - $(linkobjs) rpcrt4.lib kernel32.lib user32.lib $(conlibsdll) - - -ccs_request.h ccs_request_c.c ccs_request_s.c : $(COWIN)\ccs_request.idl $(COWIN)\ccs_request.acf - midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(cc) -cpp_opt "-E" \ - $(COWIN)\ccs_request.idl - -ccs_reply.h ccs_reply_c.c ccs_reply_s.c : $(COWIN)\ccs_reply.idl $(COWIN)\ccs_reply.acf - midl $(MIDL_OPTIMIZATION) $(MIDLI) -oldnames -cpp_cmd $(cc) -cpp_opt "-E" -I. -I$(COWIN) \ - $(COWIN)\ccs_reply.idl - -$(common) : $(CO)\$*.c - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(CO)\$*.c - -$(commonwin) : $(COWIN)\$*.c - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(COWIN)\$*.c - -$(dll) : $(LIBDIR)\$*.c - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(LIBDIR)\$*.c - -$(dllwin) : $*.c ccs_reply.h ccs_request.h - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(LIBWIN)\$*.c - -$(dllwincxx) : $*.cxx ccs_reply.h ccs_request.h - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(LIBWIN)\$*.cxx - -$(oldcc) : $(OLDCC)\$*.cxx - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(OLDCC)\$*.cxx - -$(utils) : $(CCUTIL)\$*.c - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(CCUTIL)\$*.c - -$(utilscxx) : $(CCUTIL)\$*.cxx - $(cc) $(cdebug) $(cflags) $(cvarsdll) $(CCUTIL)\$*.cxx - - - -# Clean up everything -cleanall : clean - -del *.dll - -# Clean up everything but the .EXEs -clean : - -del *.obj - -del *.map diff --git a/src/ccapi/lib/win/Makefile.in b/src/ccapi/lib/win/Makefile.in index ab958d7d6..fa4c0adef 100644 --- a/src/ccapi/lib/win/Makefile.in +++ b/src/ccapi/lib/win/Makefile.in @@ -9,6 +9,7 @@ OBJS = $(OUTPRE)ccapi_ccache.obj \ $(OUTPRE)ccapi_ipc.obj \ $(OUTPRE)ccapi_os_ipc.obj \ $(OUTPRE)ccapi_string.obj \ + $(OUTPRE)ccapi_v2.obj \ $(OUTPRE)cci_array_internal.obj \ $(OUTPRE)cci_cred_union.obj \ $(OUTPRE)cci_debugging.obj \ diff --git a/src/ccapi/server/win/Makefile b/src/ccapi/server/win/Makefile deleted file mode 100644 index deaebb2e0..000000000 --- a/src/ccapi/server/win/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -!include - -# . is ...\pismere\athena\auth\krb5\src\ccapi\server\win -CCAPI = ..\.. -CO = $(CCAPI)\common -COWIN = $(CCAPI)\common\win -CCUTIL = $(CCAPI)\common\win\OldCC -LIBDIR = $(CCAPI)\lib -LIBWIN = $(CCAPI)\lib\win -K5SRC = $(CCAPI)\.. -POSIX = $(K5SRC)\lib\krb5\posix - -INC = -I. -I.. -I$(CO) -I$(COWIN) -I$(K5SRC)\include -I..\..\..\util\et -I$(CCUTIL) - -!if "$(CPU)" == "i386" -cflags = $(cflags) /EHsc -D_CRTAPI1=_cdecl -D_CRTAPI2=_cdecl -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 \ -$(INC) -MTd -!else -cflags = $(cflags) /W3 -D_CRTAPI1= -D_CRTAPI2= $(INC) -!endif - -all : server - -server : server.exe - -common = cci_array_internal.obj cci_cred_union.obj cci_debugging.obj cci_identifier.obj \ - cci_message.obj cci_stream.obj - -commonwin = cci_os_debugging.obj \ - cci_os_identifier.obj \ - tls.obj \ - win-utils.obj - -ccutils = ccutils.obj - -ccutilscxx = opts.obj util.obj secure.obj init.obj - -dll = ccapi_string.obj - -srv = ccs_array.obj ccs_cache_collection.obj ccs_callback.obj ccs_ccache.obj \ - ccs_ccache_iterator.obj ccs_client.obj \ - ccs_credentials.obj ccs_credentials_iterator.obj ccs_list.obj ccs_list_internal.obj \ - ccs_lock.obj ccs_lock_state.obj ccs_pipe.obj ccs_server.obj - -srvwin = ccs_os_pipe.obj ccs_reply_c.obj \ - ccs_request_proc.obj ccs_win_pipe.obj - -srvwincpp = ccs_os_server.obj ccs_request_s.obj WorkItem.obj WorkQueue.obj - -linkobjs = $(common) $(commonwin) $(ccutils) $(ccutilscxx) \ - $(srv) $(srvwin) $(srvwincpp) - -includes = ccs_reply.h ccs_request.h - -# Main program: -server.exe : $(linkobjs) -# $(link) $(linkdebug) $(conflags) -MTd -out:ccapiserver.exe $(linkobjs) \ - $(link) $(linkdebug) $(conflags) -out:ccapiserver.exe $(linkobjs) \ - rpcrt4.lib advapi32.lib ws2_32.lib user32.lib - - -ccs_request.h ccs_request_s.cpp : $(COWIN)\ccs_request.idl $(COWIN)\ccs_request.acf - midl $(MIDL_OPTIMIZATION) -oldnames -cpp_cmd $(cc) -cpp_opt "-E" -I. -I$(COWIN) -sstub \ - ccs_request_s.cpp $(COWIN)\ccs_request.idl - -ccs_reply.h ccs_reply_c.c : $(COWIN)\ccs_reply.idl $(COWIN)\ccs_reply.acf - midl $(MIDL_OPTIMIZATION) -oldnames -cpp_cmd $(cc) -cpp_opt "-E" -I. -I$(COWIN) \ - $(COWIN)\ccs_reply.idl - -$(common) : $(CO)\$*.c - $(cc) $(cdebug) $(cflags) $(CO)\$*.c - -$(commonwin) : $(COWIN)\$*.c - $(cc) $(cdebug) $(cflags) $(COWIN)\$*.c - -$(ccutils) : $(CCUTIL)\$*.c - $(cc) $(cdebug) $(cflags) $(CCUTIL)\$*.c - -$(ccutilscxx) : $(CCUTIL)\$*.cxx - $(cc) $(cdebug) $(cflags) $(CCUTIL)\$*.cxx - -$(srv) : ..\$*.c - $(cc) $(cdebug) $(cflags) ..\$*.c - -$(srvwin) : $*.c $(includes) - $(cc) $(cdebug) $(cflags) $*.c - -$(srvwincpp) : $*.cpp - $(cc) $(cdebug) $(cflags) $*.cpp - - -# Clean up everything -cleanall : clean - -del *.exe - -# Clean up everything but the .EXEs -clean : - -del *.obj - -del *.map - -del ccs_request_s.c - -del ccs_request_c.c - -del ccs_request.h - -del ccs_reply_s.c - -del ccs_reply_c.c - -del ccs_reply.h diff --git a/src/ccapi/test/Makefile b/src/ccapi/test/Makefile deleted file mode 100644 index 40aad41a5..000000000 --- a/src/ccapi/test/Makefile +++ /dev/null @@ -1,119 +0,0 @@ -# run with "make all" to create CCAPI tests in "/tmp/ccapi_test" -# run resulting tests with "sh test_ccapi.sh" - -CC = gcc -LIBS = -lkrb5 - -SRCDIR = src -DSTROOT = /tmp -OBJDIR = $(DSTROOT)/ccapi_intermediates -DSTDIR = $(DSTROOT)/ccapi_test -TESTDIR = $(DSTDIR)/tests - -SCRIPT_NAME = test_ccapi.sh - -_OBJECTS = test_ccapi_ccache \ - test_ccapi_check \ - test_ccapi_constants \ - test_ccapi_context \ - test_ccapi_globals \ - test_ccapi_iterators \ - test_ccapi_log \ - test_ccapi_util \ - test_ccapi_v2 - -OBJECTS = $(patsubst %,$(OBJDIR)/%.o,$(_OBJECTS)) - -TEST_NAMES = test_constants \ - test_cc_initialize \ - test_cc_context_release \ - test_cc_context_get_change_time \ - test_cc_context_get_default_ccache_name \ - test_cc_context_open_ccache \ - test_cc_context_open_default_ccache \ - test_cc_context_create_ccache \ - test_cc_context_create_default_ccache \ - test_cc_context_create_new_ccache \ - test_cc_context_new_ccache_iterator \ - test_cc_context_compare \ - test_cc_ccache_release \ - test_cc_ccache_destroy \ - test_cc_ccache_set_default \ - test_cc_ccache_get_credentials_version \ - test_cc_ccache_get_name \ - test_cc_ccache_get_principal \ - test_cc_ccache_set_principal \ - test_cc_ccache_store_credentials \ - test_cc_ccache_remove_credentials \ - test_cc_ccache_new_credentials_iterator \ - test_cc_ccache_get_change_time \ - test_cc_ccache_get_last_default_time \ - test_cc_ccache_move \ - test_cc_ccache_compare \ - test_cc_ccache_get_kdc_time_offset \ - test_cc_ccache_set_kdc_time_offset \ - test_cc_ccache_clear_kdc_time_offset \ - test_cc_ccache_iterator_next \ - test_cc_credentials_iterator_next\ - test_cc_shutdown \ - test_cc_get_change_time \ - test_cc_open \ - test_cc_create \ - test_cc_close \ - test_cc_destroy \ - test_cc_get_cred_version \ - test_cc_get_name \ - test_cc_get_principal \ - test_cc_set_principal \ - test_cc_store \ - test_cc_remove_cred \ - test_cc_seq_fetch_NCs_begin \ - test_cc_seq_fetch_NCs_next \ - test_cc_seq_fetch_creds_begin \ - test_cc_seq_fetch_creds_next \ - test_cc_get_NC_info - - -TEST_OBJECTS = $(patsubst %,$(OBJDIR)/%.o,$(TEST_NAMES)) - -all: setup-test-dir simple_lock_test build-base build-tests link-tests copy-script success-message - -# compile base files used by all tests -build-base: $(OBJECTS) - -# compile each test -build-tests: $(TEST_OBJECTS) - -# rule to compile src files -$(OBJDIR)/%.o: %.c - $(CC) -c -o $@ $< - -# Make a build directory -setup-test-dir: - @echo "Removing old destination directory... $(DSTDIR)" - if [ -d "$(DSTDIR)" ]; then chmod -R u+w "$(DSTDIR)" && rm -rf "$(DSTDIR)"; fi - mkdir -p "$(TESTDIR)" - if [ -d "$(OBJDIR)" ]; then chmod -R u+w "$(OBJDIR)" && rm -rf "$(OBJDIR)"; fi - mkdir -p "$(OBJDIR)" - -link-tests: $(TEST_NAMES) - -$(TEST_NAMES): $(TEST_OBJECTS) - $(CC) -o $(TESTDIR)/$@ $(OBJDIR)/$@.o $(OBJECTS) $(LIBS) - -simple_lock_test: - $(CC) -o $(TESTDIR)/simple_lock_test simple_lock_test.c test_ccapi_log.c $(LIBS) - -copy-script: - cp $(SCRIPT_NAME) $(DSTDIR)/$(SCRIPT_NAME) - -success-message: - @echo - @echo "CCAPI tests created in $(DSTDIR)" - -.PHONY: clean - -clean: - -rm -rf "$(OBJDIR)" - - diff --git a/src/ccapi/test/Makefile.in b/src/ccapi/test/Makefile.in index 514b1d883..a155c1384 100644 --- a/src/ccapi/test/Makefile.in +++ b/src/ccapi/test/Makefile.in @@ -2,6 +2,7 @@ thisconfigdir=..$(S).. myfulldir=ccapi$(S)test mydir=ccapi$(S)test BUILDTOP=..$(S).. +CCAPI=$(BUILDTOP)$(S)CCAPI !if defined(KRB5_KFW_COMPILE) KFWINC= /I$(BUILDTOP)\..\..\krbcc\include @@ -10,7 +11,7 @@ KFWINC= /I$(BUILDTOP)\..\..\krbcc\include # Because all the sources are in ., # the only includes we need are to directories outside of ccapi. LOCALINCLUDES = /I$(BUILDTOP) /I$(BUILDTOP)$(S)include /I$(BUILDTOP)$(S)include$(S)krb5 $(KFWINC) \ - -I$(BUILDTOP)$(S)util$(S)et /I. + -I$(BUILDTOP)$(S)util$(S)et /I. -I$(CCAPI)$(S)COMMON -I$(CCAPI)$(S)LIB # run with "make all" to create CCAPI tests in "/tmp/ccapi_test" # run resulting tests with "sh test_ccapi.sh" @@ -26,11 +27,28 @@ LOCALINCLUDES = /I$(BUILDTOP) /I$(BUILDTOP)$(S)include /I$(BUILDTOP)$(S)include$ ##DOS## cci_types.h \ ##DOS## win-utils.h +##DOS##LIBSRC=ccapi_ccache.c \ +##DOS## ccapi_ccache_iterator.c \ +##DOS## ccapi_context.c \ +##DOS## ccapi_context_change_time.c \ +##DOS## ccapi_ipc.c \ +##DOS## ccapi_credentials.c \ +##DOS## ccapi_credentials_iterator.c \ +##DOS## ccapi_v2.c + +##DOS##COMSRC=cci_cred_union.c \ +##DOS## cci_identifier.c \ +##DOS## cci_message.c \ +##DOS## cci_stream.c + +##DOS##COWSRC=cci_os_identifier.c + SRCDIR = . DSTROOT = $(SRCDIR) OBJDIR = $(DSTROOT)$(S)ccapi_intermediates DSTDIR = $(DSTROOT)$(S)ccapi_test TESTDIR = $(DSTDIR)$(S)tests +SRCTMP = $(SRCDIR)\srctmp SCRIPT_NAME = test_ccapi.sh @@ -44,7 +62,20 @@ OBJECTS = $(OUTPRE)test_ccapi_ccache.$(OBJEXT) \ $(OUTPRE)test_ccapi_log.$(OBJEXT) \ $(OUTPRE)test_ccapi_util.$(OBJEXT) -PINGOBJS = $(OUTPRE)ccs_request_c.$(OBJEXT) \ +PINGOBJS = $(OUTPRE)ccapi_ccache.$(OBJEXT) \ + $(OUTPRE)ccapi_ccache_iterator.$(OBJEXT) \ + $(OUTPRE)ccapi_context.$(OBJEXT) \ + $(OUTPRE)ccapi_context_change_time.$(OBJEXT) \ + $(OUTPRE)ccapi_ipc.$(OBJEXT) \ + $(OUTPRE)ccapi_credentials.$(OBJEXT) \ + $(OUTPRE)ccapi_credentials_iterator.$(OBJEXT) \ + $(OUTPRE)ccapi_v2.$(OBJEXT) \ + $(OUTPRE)cci_cred_union.$(OBJEXT) \ + $(OUTPRE)cci_identifier.$(OBJEXT) \ + $(OUTPRE)cci_os_identifier.$(OBJEXT) \ + $(OUTPRE)cci_message.$(OBJEXT) \ + $(OUTPRE)cci_stream.$(OBJEXT) \ + $(OUTPRE)ccs_request_c.$(OBJEXT) \ $(OUTPRE)pingtest.$(OBJEXT) \ $(OBJECTS) @@ -135,7 +166,7 @@ setup-test-dir: mkdir -p "$(OBJDIR)" ## The same trick as used in TEST_NAMES to run an action on each element ofthe list WINH: -setup-windows: $(WINH) +setup-windows: $(WINH) $(LIBSRC) $(COMSRC) $(COWSRC) if NOT exist $(TESTDIR) mkdir $(TESTDIR) if NOT exist $(OBJDIR) mkdir $(OBJDIR) set LINK = link @@ -145,6 +176,15 @@ setup-windows: $(WINH) $(WINH): copy ..\lib\win\srctmp\$@ . +$(LIBSRC): + copy ..\lib\$@ . + +$(COMSRC): + copy ..\common\$@ . + +$(COWSRC): + copy ..\common\win\$@ . + # This rule assumes that nmake in ..\lib\win\ has already run. $(OUTPRE)pingtest.exe: $(OBJECTS) $(PINGOBJS) # There doesn't appear to be any way to examine a variable and return a value diff --git a/src/ccapi/test/test_ccapi_util.c b/src/ccapi/test/test_ccapi_util.c index eb37868ae..1f66c991b 100644 --- a/src/ccapi/test/test_ccapi_util.c +++ b/src/ccapi/test/test_ccapi_util.c @@ -3,7 +3,9 @@ #include #include #include +#include +#include "k5-platform.h" /* pull in asprintf decl/defn */ #include "test_ccapi_util.h" diff --git a/src/ccapi/test/test_ccapi_v2.c b/src/ccapi/test/test_ccapi_v2.c index 20e09f2c4..054d216e6 100644 --- a/src/ccapi/test/test_ccapi_v2.c +++ b/src/ccapi/test/test_ccapi_v2.c @@ -1,4 +1,5 @@ #include +#include "k5-platform.h" /* pull in asprintf decl/defn */ #include "test_ccapi_v2.h" #include #include @@ -1482,8 +1483,6 @@ int check_cc_seq_fetch_NCs_next(void) { cc_result check_once_cc_seq_fetch_NCs_next(apiCB *context, ccache_cit *iterator, cc_uint32 expected_count, cc_result expected_err, const char *description) { cc_result err = CC_NOERROR; - BEGIN_CHECK_ONCE(description); - cc_result possible_return_values[5] = { CC_NOERROR, CC_END, @@ -1496,6 +1495,8 @@ cc_result check_once_cc_seq_fetch_NCs_next(apiCB *context, ccache_cit *iterator, ccache_p *ccache = NULL; cc_uint32 actual_count = 0; + BEGIN_CHECK_ONCE(description); + while (!err) { err = cc_seq_fetch_NCs_next(context, &ccache, iterator); if (ccache) { @@ -1588,8 +1589,6 @@ cc_result check_once_cc_get_NC_info(apiCB *context, cc_result err = CC_NOERROR; infoNC **info = NULL; - BEGIN_CHECK_ONCE(description); - cc_result possible_return_values[4] = { CC_NOERROR, CC_BAD_PARM, @@ -1600,6 +1599,8 @@ cc_result check_once_cc_get_NC_info(apiCB *context, cc_uint32 actual_count = 0; + BEGIN_CHECK_ONCE(description); + err = cc_get_NC_info(context, &info); for (actual_count = 0; !err && info[actual_count]; actual_count++) {