diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e0c8b1a8..6e310cf5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -5,6 +5,9 @@ on: pull_request: workflow_dispatch: +env: + FORM_IGNORE_DEPRECATION: 1 + jobs: # Generate the tarball distribution, e.g., "form-v4.2.1.tar.gz" for v4.2.1. # The tarball will be tested in the following "build-bin" job. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dce6465e..15a9455c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,9 @@ on: pull_request: workflow_dispatch: +env: + FORM_IGNORE_DEPRECATION: 1 + jobs: # Simple tests on Linux; except the ParFORM case, they probably pass unless # the committer has forgotten running "make check". diff --git a/sources/checkpoint.c b/sources/checkpoint.c index 9bf64e6f..5df5f291 100644 --- a/sources/checkpoint.c +++ b/sources/checkpoint.c @@ -840,6 +840,7 @@ static void print_M() MesPrint("%d", AM.ggShortStatsMax); MesPrint("--MARK 11"); MesPrint("%d", AM.FromStdin); + MesPrint("%d", AM.IgnoreDeprecation); MesPrint("%%%% END M_const"); /* fflush(0); */ } @@ -1503,6 +1504,7 @@ int DoRecovery(int *moduletype) R_COPY_S(AM.Path,UBYTE *); R_SET(AM.FromStdin, BOOL); + R_SET(AM.IgnoreDeprecation, BOOL); #ifdef PRINTDEBUG print_M(); @@ -2574,6 +2576,7 @@ static int DoSnapshot(int moduletype) S_WRITE_S(AM.Path); S_WRITE_B(&AM.FromStdin,sizeof(BOOL)); + S_WRITE_B(&AM.IgnoreDeprecation,sizeof(BOOL)); /*#] AM :*/ /*#[ AC :*/ diff --git a/sources/compcomm.c b/sources/compcomm.c index d76973ad..53a0f5a3 100644 --- a/sources/compcomm.c +++ b/sources/compcomm.c @@ -608,6 +608,7 @@ int CoOff(UBYTE *s) AR.gzipCompress = 0; } else if ( StrICont(t,(UBYTE *)"checkpoint") == 0 ) { + PrintDeprecation("the checkpoint mechanism", "issues/626"); AC.CheckpointInterval = 0; if ( AC.CheckpointRunBefore ) { free(AC.CheckpointRunBefore); AC.CheckpointRunBefore = NULL; } if ( AC.CheckpointRunAfter ) { free(AC.CheckpointRunAfter); AC.CheckpointRunAfter = NULL; } @@ -706,6 +707,7 @@ int CoOn(UBYTE *s) } } else if ( StrICont(t,(UBYTE *)"checkpoint") == 0 ) { + PrintDeprecation("the checkpoint mechanism", "issues/626"); AC.CheckpointInterval = 0; if ( AC.CheckpointRunBefore ) { free(AC.CheckpointRunBefore); AC.CheckpointRunBefore = NULL; } if ( AC.CheckpointRunAfter ) { free(AC.CheckpointRunAfter); AC.CheckpointRunAfter = NULL; } diff --git a/sources/declare.h b/sources/declare.h index 15c26b42..6f3410df 100644 --- a/sources/declare.h +++ b/sources/declare.h @@ -672,6 +672,7 @@ extern WORD Processor(VOID); extern WORD Product(UWORD *,WORD *,WORD); extern VOID PrtLong(UWORD *,WORD,UBYTE *); extern VOID PrtTerms(VOID); +extern void PrintDeprecation(const char *,const char *); extern VOID PrintRunningTime(VOID); extern LONG GetRunningTime(VOID); extern WORD PutBracket(PHEAD WORD *); diff --git a/sources/startup.c b/sources/startup.c index 58e6ade4..d4baf1a9 100644 --- a/sources/startup.c +++ b/sources/startup.c @@ -194,6 +194,18 @@ static void PrintHeader(int with_full_info) AC.LineLength = oldLineLength; } } +#ifdef WINDOWS + PrintDeprecation("the native Windows version", "issues/623"); +#endif +#ifdef ILP32 + PrintDeprecation("the 32-bit version", "issues/624"); +#endif +#ifdef WITHMPI + PrintDeprecation("the MPI version (ParFORM)", "issues/625"); +#endif + if ( AC.CheckpointFlag ) { + PrintDeprecation("the checkpoint mechanism", "issues/626"); + } } /* @@ -261,9 +273,17 @@ int DoTail(int argc, UBYTE **argv) AM.FileOnlyFlag = 1; AM.LogType = 1; break; case 'h': /* For old systems: wait for key before exit */ AM.HoldFlag = 1; break; + case 'i': + if ( StrCmp(s, (UBYTE *)"ignore-deprecation") == 0 ) { + AM.IgnoreDeprecation = 1; + break; + } #ifdef WITHINTERACTION - case 'i': /* Interactive session (not used yet) */ - AM.Interact = 1; break; + /* Interactive session (not used yet) */ + AM.Interact = 1; + break; +#else + goto IllegalOption; #endif case 'I': /* Next arg is dir for inc/prc/sub files */ TAKEPATH(AM.IncDir) break; @@ -426,6 +446,7 @@ printversion:; } } else { +IllegalOption: #ifdef WITHMPI if ( PF.me == MASTER ) #endif @@ -1890,6 +1911,36 @@ VOID Terminate(int errorcode) /* #] Terminate : + #[ PrintDeprecation : +*/ + +/** + * Prints a deprecation warning for a given feature. + * + * @param feature The name of the deprecated feature. + * @param issue The associated issue, e.g., "issues/700". + */ +void PrintDeprecation(const char *feature, const char *issue) { +#ifdef WITHMPI + if ( PF.me != MASTER ) return; +#endif + if ( AM.IgnoreDeprecation ) return; + + UBYTE *e = (UBYTE *)getenv("FORM_IGNORE_DEPRECATION"); + if ( e && e[0] && StrCmp(e, (UBYTE *)"0") && StrICmp(e, (UBYTE *)"false") && StrICmp(e, (UBYTE *)"no") ) return; + + MesPrint("DeprecationWarning: We are considering deprecating %s.", feature); + MesPrint("If you want this support to continue, leave a comment at:"); + MesPrint(""); + MesPrint(" https://github.com/vermaseren/form/%s", issue); + MesPrint(""); + MesPrint("Otherwise, it will be discontinued in the future."); + MesPrint("To suppress this warning, use the -ignore-deprecation command line option or"); + MesPrint("set the environment variable FORM_IGNORE_DEPRECATION=1."); +} + +/* + #] PrintDeprecation : #[ PrintRunningTime : */ diff --git a/sources/structs.h b/sources/structs.h index 9daaa0cb..4c2ffff5 100644 --- a/sources/structs.h +++ b/sources/structs.h @@ -1600,11 +1600,12 @@ struct M_const { WORD numpi; WORD BracketFactors[8]; BOOL FromStdin; /* read the input from STDIN */ + BOOL IgnoreDeprecation; /* ignore deprecation warning */ #ifdef WITHFLOAT #ifdef WITHPTHREADS PADPOSITION(17,30,62,84,(sizeof(pthread_rwlock_t)+sizeof(pthread_mutex_t)*2)+1); #else - PADPOSITION(17,28,62,84,1); + PADPOSITION(17,28,62,84,2); #endif #else #ifdef WITHPTHREADS