--- a/lib/libfossil.c
+++ b/lib/libfossil.c
@@ -989,7 +989,7 @@
 #undef FLCA
 }
 
-void * fsl_realloc_f_stdalloc(void * state __unused, void * mem, fsl_size_t n){
+void * fsl_realloc_f_stdalloc(void * state __libfossil_unused, void * mem, fsl_size_t n){
   if(!mem){
     return malloc(n);
   }else if(!n){
@@ -2895,7 +2895,7 @@
    string.
 */
 static int spech_urlencode( fsl_output_f pf, void * pfArg,
-                            unsigned int pfLen __unused, void * varg ){
+                            unsigned int pfLen __libfossil_unused, void * varg ){
   char const * str = (char const *) varg;
   int rc = 0;
   char ch = 0;
@@ -5154,7 +5154,7 @@
   return fsl_buffer_append((fsl_buffer*)state, src, n);
 }
 
-int fsl_finalizer_f_buffer( void * state __unused, void * mem ){
+int fsl_finalizer_f_buffer( void * state __libfossil_unused, void * mem ){
   fsl_buffer * b = (fsl_buffer*)mem;
   fsl_buffer_reserve(b, 0);
   *b = fsl_buffer_empty;
@@ -10723,7 +10723,7 @@
 /**
     Proxies fslAllocOrig.f() and abort()s on OOM conditions.
 */
-static void * fsl_realloc_f_failing(void * state __unused, void * mem, fsl_size_t n){
+static void * fsl_realloc_f_failing(void * state __libfossil_unused, void * mem, fsl_size_t n){
   void * rv = fslAllocOrig.f(fslAllocOrig.state, mem, n);
   if(n && !rv){
     fsl__fatal(FSL_RC_OOM, NULL)/*does not return*/;
@@ -18731,17 +18731,17 @@
     fsl_list_visitor_f() impl which requires that obj be-a (fsl_card_T*),
     which this function passes to fsl_card_T_free().
 */
-static int fsl_list_v_card_T_free(void * obj, void * visitorState __unused){
+static int fsl_list_v_card_T_free(void * obj, void * visitorState __libfossil_unused){
   if(obj) fsl_card_T_free( (fsl_card_T*)obj );
   return 0;
 }
 
-static int fsl_list_v_card_Q_free(void * obj, void * visitorState __unused ){
+static int fsl_list_v_card_Q_free(void * obj, void * visitorState __libfossil_unused ){
   if(obj) fsl_card_Q_free( (fsl_card_Q*)obj );
   return 0;
 }
 
-static int fsl_list_v_card_J_free(void * obj, void * visitorState __unused){
+static int fsl_list_v_card_J_free(void * obj, void * visitorState __libfossil_unused){
   if(obj) fsl_card_J_free( (fsl_card_J*)obj );
   return 0;
 }
@@ -22016,7 +22016,7 @@
    Overrideable crosslink listener which updates the timeline for
    attachment records.
 */
-static int fsl_deck_xlink_f_attachment(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_attachment(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_ATTACHMENT!=d->type) return 0;
   int rc;
   fsl_db * const db = fsl_cx_db_repo(d->f);
@@ -22094,7 +22094,7 @@
    Overrideable crosslink listener which updates the timeline for
    checkin records.
 */
-static int fsl_deck_xlink_f_checkin(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_checkin(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_CHECKIN!=d->type) return 0;
   int rc;
   fsl_db * db;
@@ -22142,7 +22142,7 @@
   return fsl_cx_uplift_db_error2(d->f, db, rc);
 }
 
-static int fsl_deck_xlink_f_control(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_control(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_CONTROL!=d->type) return 0;
   /*
     Create timeline event entry for all tags in this control
@@ -22289,7 +22289,7 @@
 
 }
 
-static int fsl_deck_xlink_f_forum(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_forum(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_FORUMPOST!=d->type) return 0;
   int rc = 0;
   fsl_db * const db = fsl_cx_db_repo(d->f);
@@ -22375,7 +22375,7 @@
 }
 
 
-static int fsl_deck_xlink_f_technote(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_technote(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_TECHNOTE!=d->type) return 0;
   char buf[FSL_STRLEN_K256 + 7 /* event-UUID\0 */] = {0};
   fsl_id_t tagid;
@@ -22424,7 +22424,7 @@
   return rc;
 }
 
-static int fsl_deck_xlink_f_wiki(fsl_deck * const d, void * state __unused){
+static int fsl_deck_xlink_f_wiki(fsl_deck * const d, void * state __libfossil_unused){
   if(FSL_SATYPE_WIKI!=d->type) return 0;
   int rc;
   char const * zWiki;
@@ -26176,7 +26176,7 @@
   return rc;
 }
 
-static int fdb__tcl_finish(fsl_dibu * const b __unused){
+static int fdb__tcl_finish(fsl_dibu * const b __libfossil_unused){
   int rc = 0;
 #if 0
   BR_CLOSE;
@@ -28947,10 +28947,10 @@
 static int fociConnect(
   sqlite3 *db,
   void *pAux /*a (fsl_cx*) */,
-  int argc __unused,
-  const char * const * argv __unused,
+  int argc __libfossil_unused,
+  const char * const * argv __libfossil_unused,
   sqlite3_vtab **ppVtab,
-  char **pzErr __unused
+  char **pzErr __libfossil_unused
 ){
   FociTable *pTab;
   int rc = SQLITE_OK;
@@ -28983,7 +28983,7 @@
  *   (1)     checkinID=?.  visit only the single manifest specified.
  *   (2)     symName=?     visit only the single manifest specified.
  */
-static int fociBestIndex(sqlite3_vtab *tab __unused, sqlite3_index_info *pIdxInfo){
+static int fociBestIndex(sqlite3_vtab *tab __libfossil_unused, sqlite3_index_info *pIdxInfo){
   int i;
   pIdxInfo->estimatedCost = 1000000000.0;
   for( i=0; i<pIdxInfo->nConstraint; i++ ){
@@ -29056,8 +29056,8 @@
 
 static int fociFilter(
   sqlite3_vtab_cursor *pCursor,
-  int idxNum, const char *idxStr __unused,
-  int argc __unused, sqlite3_value **argv
+  int idxNum, const char *idxStr __libfossil_unused,
+  int argc __libfossil_unused, sqlite3_value **argv
 ){
   int rc = SQLITE_OK;
   FociCursor *const pCur = (FociCursor *)pCursor;
@@ -31062,7 +31062,7 @@
     : (feof(f) ? 0 : FSL_RC_IO);
 }
 
-void fsl_finalizer_f_FILE( void * state __unused, void * mem ){
+void fsl_finalizer_f_FILE( void * state __libfossil_unused, void * mem ){
   if(mem){
     fsl_fclose((FILE*)mem);
   }
@@ -31546,7 +31546,7 @@
   return 0;
 }
 
-int fsl_list_v_fsl_free(void * obj, void * visitorState __unused){
+int fsl_list_v_fsl_free(void * obj, void * visitorState __libfossil_unused){
   if(obj) fsl_free( obj );
   return 0;
 }
@@ -41353,8 +41353,8 @@
 */
 static void fsl_db_now_udf(
   sqlite3_context *context,
-  int argc __unused,
-  sqlite3_value **argv __unused
+  int argc __libfossil_unused,
+  sqlite3_value **argv __libfossil_unused
 ){
   sqlite3_result_int64(context, (sqlite3_int64)time(0));
 }
@@ -41364,8 +41364,8 @@
 */
 static void fsl_db_j2u_udf(
   sqlite3_context *context,
-  int argc __unused,
-  sqlite3_value **argv __unused
+  int argc __libfossil_unused,
+  sqlite3_value **argv __libfossil_unused
 ){
   double const jd = (double)sqlite3_value_double(argv[0]);
   sqlite3_result_int64(context, (sqlite3_int64)fsl_julian_to_unix(jd));
@@ -41578,8 +41578,8 @@
 */
 static void fsl_db_user_udf(
   sqlite3_context *context,
-  int argc __unused,
-  sqlite3_value **argv __unused
+  int argc __libfossil_unused,
+  sqlite3_value **argv __libfossil_unused
 ){
   fsl_cx * f = (fsl_cx*)sqlite3_user_data(context);
   assert(f);
--- a/lib/libfossil.h
+++ b/lib/libfossil.h
@@ -272,8 +272,8 @@
    TODO: add support for the C++ attributes for doing this.
 */
 
-#if !defined(__unused)
-#define __unused
+#if !defined(__libfossil_unused)
+#define __libfossil_unused
 #endif
 
 
