mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-27 18:20:02 -05:00
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
This commit is contained in:
parent
4e33e351a3
commit
a87e39c8e6
6 changed files with 20 additions and 43 deletions
|
|
@ -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 ; \
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
BIN
testdata/01-doc.tpkg
vendored
BIN
testdata/01-doc.tpkg
vendored
Binary file not shown.
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
39
util/locks.h
39
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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue