diff --git a/NEWS b/NEWS index 76b65357..962a50db 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,8 @@ Changes since version 7.3: * Issues fixed: - Avrintel.h missing from installation #1683 - Use of undeclared identifier 'AVRDUDE_FULL_VERSION' #1706 + - Wrong message level in jtag3_prmsg() #1726 + - Old avrdude_message() can go away #1719 * Pull requests: - Remove 32bit MSYS2 mingw32 and clang32 build #1687 @@ -30,6 +32,9 @@ Changes since version 7.3: - Change port array in PROGRAMMER to be const char * #1699 - Fix cmake build errors related to ac_cfg.h #1707 - Add benchmark option -b for test-avrdude #1709 + - Replace msg_info() by msg_debug() in jtag3_prmsg() + and jtag3_prevent() #1727 + - Remove unused avrdude_message() #1730 * Internals: diff --git a/src/avrdude.h b/src/avrdude.h index 522cd7c3..af3ae443 100644 --- a/src/avrdude.h +++ b/src/avrdude.h @@ -40,6 +40,25 @@ extern int quell_progress; // Quell progress report -q, reduce effective verbo extern const char *partdesc; // Part -p string extern const char *pgmid; // Programmer -c string +int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...); + +#define MSG_EXT_ERROR (-3) // OS-type error, no -v option, can be suppressed with -qqqqq +#define MSG_ERROR (-2) // Avrdude error, no -v option, can be suppressed with -qqqq +#define MSG_WARNING (-1) // Warning, no -v option, can be suppressed with -qqq +#define MSG_INFO 0 // Commentary, no -v option, can be suppressed with -qq +#define MSG_NOTICE 1 // Displayed with -v +#define MSG_NOTICE2 2 // Displayed with -vv +#define MSG_DEBUG 3 // Displayed with -vvv +#define MSG_TRACE 4 // Displayed with -vvvv, show trace communication +#define MSG_TRACE2 5 // Displayed with -vvvvv + +#define MSG2_PROGNAME 1 // Start by printing progname +#define MSG2_FUNCTION 2 // Print calling function (1st arg) after progname if >= notice +#define MSG2_FILELINE 4 // Print source file and line number after function if >= debug +#define MSG2_TYPE 8 // Print message type after function or progname +#define MSG2_INDENT1 16 // Start by printing indentation of progname+1 blanks +#define MSG2_INDENT2 32 // Start by printing indentation of progname+2 blanks +#define MSG2_FLUSH 64 // Flush before and after printing // Shortcuts #define msg_ext_error(...) avrdude_message2(stderr, __LINE__, __FILE__, __func__, 0, MSG_EXT_ERROR, __VA_ARGS__) diff --git a/src/main.c b/src/main.c index d404732b..b1161867 100644 --- a/src/main.c +++ b/src/main.c @@ -57,19 +57,6 @@ char progbuf[PATH_MAX]; /* temporary buffer of spaces the same length as progname; used for lining up multiline messages */ -// Old (deprecated) message routine -int avrdude_message(int msglvl, const char *format, ...) -{ - int rc = 0; - va_list ap; - if (verbose >= msglvl) { - va_start(ap, format); - rc = vfprintf(stderr, format, ap); - va_end(ap); - } - return rc; -} - static const char *avrdude_message_type(int msglvl) { switch(msglvl) { case MSG_EXT_ERROR: return "OS error"; @@ -90,6 +77,9 @@ static const char *avrdude_message_type(int msglvl) { * Core msg_xyz() routine * See #define lines in avrdude.h of how it is normally called * Side note: if format starts with \v print \n but only if *not* at beginning of line + * + * Function is named that way since there used to be a different avrdude_message() + * before which is gone now. */ int avrdude_message2(FILE *fp, int lno, const char *file, const char *func, int msgmode, int msglvl, const char *format, ...) { int rc = 0;