From a87e39c8e6e9d94e037762f12fbcc18f1d82ee4e Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 20 Feb 2007 15:47:27 +0000 Subject: [PATCH] locks.h doxygen not enforced, it looks bad. no lint and doxygen on yacc and lex generated files. added doc to config_file.h git-svn-id: file:///svn/unbound/trunk@132 be551aaa-1e26-0410-a405-d3ace91eadb9 --- Makefile.in | 2 +- doc/unbound.doxygen | 2 +- testdata/01-doc.tpkg | Bin 800 -> 836 bytes util/config_file.c | 12 +++++++++++- util/config_file.h | 8 +++++++- util/locks.h | 39 --------------------------------------- 6 files changed, 20 insertions(+), 43 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1f79b20aa..f2dd6604e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -115,7 +115,7 @@ realclean: clean rm -f Makefile lint: - $Qfor i in $(sort $(ALL_SRC)); do \ + $Qfor i in $(filter-out util/configparser.c,$(filter-out util/configlexer.c,$(sort $(ALL_SRC)))); do \ echo lint $$i; \ $(LINT) $(LINTFLAGS) -I. -I$(srcdir) -I$(ldnsdir)/include $(srcdir)/$$i ; \ if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ diff --git a/doc/unbound.doxygen b/doc/unbound.doxygen index baf13faaf..73f9470e7 100644 --- a/doc/unbound.doxygen +++ b/doc/unbound.doxygen @@ -480,7 +480,7 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = ./build ./compat +EXCLUDE = ./build ./compat util/configparser.c util/configparser.h util/configlexer.c util/locks.h # The EXCLUDE_SYMLINKS tag can be used select whether or not files or # directories that are symbolic links (a Unix filesystem feature) are excluded diff --git a/testdata/01-doc.tpkg b/testdata/01-doc.tpkg index 500d5ec9182870126aed43599f7aa02824d15e97..a2e5f0e5c0f183953b9abe041379d115c6c9c30c 100644 GIT binary patch literal 836 zc-jF(1H1emiwFRo6x&4r1MQY=PunmMfcYB#ic?y#7pZwEw3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(B4dFo|kUWdJ|g1VKuP))&| z;-(!#v95dYsHtK}^+Q8O)_cy5DVxj`&dlsVC7X>gNyNc?)CS$zB~`2ntCP*#D%>8X zv6ty0@0rq8p6NDnP}c%+oCw;u!^Ek#-C=Q7-eosJbC6L5qBK>pDwxnz^HN~ZIh%Aj zn2)3sjIe92p@Ty5+9$u}_xnFl@veRR`Tq9@qw4+NAC3lLFf{l7U=$AR{r@-kfJfpB z9*Jo429R$|Dy-cI0?#MMOvREfbtRZ&EM9C^IGIRRb&jb<6BjIjPgDR5AP6J;^8=Vn z&!La`CZ`nd5d3E{f<$_7;Z3|FZ1_)+QYsTgCTJurN55$?&ICsCSMxe$;%)$kFQh#GGo>KEnruB@sEHJYShPuf6XUi^XEGSS%Kc e#bU8oEEbE!VzF2(7K_EQYkmRf#bG!AC;$Mn+=Uwe diff --git a/util/config_file.c b/util/config_file.c index 7894a810d..df6d34e03 100644 --- a/util/config_file.c +++ b/util/config_file.c @@ -45,11 +45,19 @@ #include "util/configyyrename.h" #include "util/config_file.h" #include "util/configparser.h" +/** global config during parsing */ struct config_parser_state* cfg_parser = 0; -extern FILE* ub_c_in, *ub_c_out; +/** lex in file */ +extern FILE* ub_c_in; +/** lex out file */ +extern FILE* ub_c_out; +/** the yacc lex generated parse function */ int ub_c_parse(void); +/** the lexer function */ int ub_c_lex(void); +/** wrap function */ int ub_c_wrap(void); +/** print error with file and line number */ void ub_c_error(const char *message); struct config_file* @@ -85,6 +93,7 @@ config_delete(struct config_file* cfg) free(cfg); } +/** print error with file and line number */ void ub_c_error_va_list(const char *fmt, va_list args) { cfg_parser->errors++; @@ -94,6 +103,7 @@ void ub_c_error_va_list(const char *fmt, va_list args) fprintf(stderr, "\n"); } +/** print error with file and line number */ void ub_c_error_msg(const char* fmt, ...) { va_list args; diff --git a/util/config_file.h b/util/config_file.h index 99223653a..f11c65a4f 100644 --- a/util/config_file.h +++ b/util/config_file.h @@ -83,15 +83,21 @@ void config_delete(struct config_file* config); * Used during options parsing */ struct config_parser_state { + /** name of file being parser */ char* filename; + /** line number in the file, starts at 1 */ int line; + /** number of errors encountered */ int errors; + /** the result of parsing is stored here. */ struct config_file* cfg; }; +/** global config parser object used during config parsing */ extern struct config_parser_state* cfg_parser; -/* parsing helpers */ +/** parsing helpers: print error with file and line numbers. */ void ub_c_error(const char* msg); +/** parsing helpers: print error with file and line numbers. */ void ub_c_error_msg(const char* fmt, ...) ATTR_FORMAT(printf, 1, 2); #endif /* UTIL_CONFIG_FILE_H */ diff --git a/util/locks.h b/util/locks.h index bb8eaef66..317187cf7 100644 --- a/util/locks.h +++ b/util/locks.h @@ -78,24 +78,17 @@ typedef pthread_rwlock_t lock_rw_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_rw_init(lock) LOCKRET(pthread_rwlock_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_rw_destroy(lock) LOCKRET(pthread_rwlock_destroy(lock)) -/** acquire a read lock */ #define lock_rw_rdlock(lock) LOCKRET(pthread_rwlock_rdlock(lock)) -/** acquire a write lock */ #define lock_rw_wrlock(lock) LOCKRET(pthread_rwlock_wrlock(lock)) -/** unlock previously acquired read or write lock */ #define lock_rw_unlock(lock) LOCKRET(pthread_rwlock_unlock(lock)) /** use pthread mutex for basic lock */ typedef pthread_mutex_t lock_basic_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) -/** acquire lock. This may block indefinetely. */ #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) -/** unlock acquired lock. */ #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) #ifndef HAVE_PTHREAD_SPINLOCK_T @@ -103,11 +96,8 @@ typedef pthread_mutex_t lock_basic_t; typedef pthread_mutex_t lock_quick_t; /** small front for pthread init func, NULL is default attrs. */ #define lock_quick_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) -/** free up the lock. must be unlocked. */ #define lock_quick_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) -/** acquire lock. may block. */ #define lock_quick_lock(lock) LOCKRET(pthread_mutex_lock(lock)) -/** unlock acquired lock. */ #define lock_quick_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) #else /* HAVE_PTHREAD_SPINLOCK_T */ @@ -121,11 +111,8 @@ typedef pthread_spinlock_t lock_quick_t; * spinlocks are not supported on all pthread platforms. */ #define lock_quick_init(lock) LOCKRET(pthread_spin_init(lock, PTHREAD_PROCESS_PRIVATE)) -/** free up the lock. must be unlocked. */ #define lock_quick_destroy(lock) LOCKRET(pthread_spin_destroy(lock)) -/** acquire lock. This may block indefinetely, and will spin. */ #define lock_quick_lock(lock) LOCKRET(pthread_spin_lock(lock)) -/** unlock acquired lock. */ #define lock_quick_unlock(lock) LOCKRET(pthread_spin_unlock(lock)) #endif /* HAVE SPINLOCK */ @@ -140,37 +127,24 @@ typedef pthread_t ub_thread_t; /******************* SOLARIS THREADS ************************/ typedef rwlock_t lock_rw_t; -/** create thisprocessonly lock */ #define lock_rw_init(lock) LOCKRET(rwlock_init(lock, USYNC_THREAD, NULL)) -/** destroy it */ #define lock_rw_destroy(lock) LOCKRET(rwlock_destroy(lock)) -/** lock read */ #define lock_rw_rdlock(lock) LOCKRET(rw_rdlock(lock)) -/** lock write */ #define lock_rw_wrlock(lock) LOCKRET(rw_wrlock(lock)) -/** unlock */ #define lock_rw_unlock(lock) LOCKRET(rw_unlock(lock)) /** use basic mutex */ typedef mutex_t lock_basic_t; -/** create */ #define lock_basic_init(lock) LOCKRET(mutex_init(lock, USYNC_THREAD, NULL)) -/** destroy */ #define lock_basic_destroy(lock) LOCKRET(mutex_destroy(lock)) -/** lock */ #define lock_basic_lock(lock) LOCKRET(mutex_lock(lock)) -/** unlock */ #define lock_basic_unlock(lock) LOCKRET(mutex_unlock(lock)) /** No spinlocks in solaris threads API. Use a mutex. */ typedef mutex_t lock_quick_t; -/** create */ #define lock_quick_init(lock) LOCKRET(mutex_init(lock, USYNC_THREAD, NULL)) -/** destroy */ #define lock_quick_destroy(lock) LOCKRET(mutex_destroy(lock)) -/** lock */ #define lock_quick_lock(lock) LOCKRET(mutex_lock(lock)) -/** unlock */ #define lock_quick_unlock(lock) LOCKRET(mutex_unlock(lock)) /** Thread creation, create a default thread. */ @@ -182,37 +156,24 @@ typedef thread_t ub_thread_t; /******************* NO THREADS ************************/ /** In case there is no thread support, define locks to do nothing */ typedef int lock_rw_t; -/** does nothing */ #define lock_rw_init(lock) /* nop */ -/** does nothing */ #define lock_rw_destroy(lock) /* nop */ -/** does nothing */ #define lock_rw_rdlock(lock) /* nop */ -/** does nothing */ #define lock_rw_wrlock(lock) /* nop */ -/** does nothing */ #define lock_rw_unlock(lock) /* nop */ /** define locks to do nothing */ typedef int lock_basic_t; -/** does nothing */ #define lock_basic_init(lock) /* nop */ -/** does nothing */ #define lock_basic_destroy(lock) /* nop */ -/** does nothing */ #define lock_basic_lock(lock) /* nop */ -/** does nothing */ #define lock_basic_unlock(lock) /* nop */ /** define locks to do nothing */ typedef int lock_quick_t; -/** does nothing */ #define lock_quick_init(lock) /* nop */ -/** does nothing */ #define lock_quick_destroy(lock) /* nop */ -/** does nothing */ #define lock_quick_lock(lock) /* nop */ -/** does nothing */ #define lock_quick_unlock(lock) /* nop */ /** Thread creation, threads do not exist */ -- 2.47.2