Re: Discussion about why GNU/Linux system upgrades cause old programs to break
Arsen Arsenović <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Message-ID | <[email protected]> |
Richard Stallman <[email protected]> writes: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > I've seen some projects do the following for C++: > > > AC_DEFUN([NMS_CXX_11], > > [AC_MSG_CHECKING([whether $CXX is for C++11]) > > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ > > [#if __cplusplus != 201103 > > #error "C++11 is required" > > #endif > > ]])], > > [AC_MSG_RESULT([yes])], > > [CXX_ORIG="$CXX" > > CXX="$CXX -std=c++11" > > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ > > [#if __cplusplus != 201103 > > #error "C++11 is required" > > #endif > > ]])], > > AC_MSG_RESULT([adding -std=c++11]), > > [CXX="$CXX_ORIG" > > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ > > [#if __cplusplus > 201103 > > #error "C++11 is required" > > #endif > > ]])], > > AC_MSG_RESULT([> C++11]), > > AC_MSG_RESULT([no]) > > AC_MSG_ERROR([C++11 is required])])) > > unset CXX_ORIG])]) > > That sounds clean in principle, but I think it would break compilation > on the platforms, and the individual machines, that don't have a C11 > compiler. (Maybe running an old system version which doesn't have one > at all. Maybe that user can't, or doesn't dare, upgrade.) That would > cause trouble for a lot of users. > > It would be wrong for us to do that to Emacs. It is not a solution. The above is not even written for C. I just used it as an illustration of what I mean, I did not intend to propose it for inclusion into Emacs. I think the right thing to do is, as I said, always pass at least one -std= flag with which the developers tested, even if that flag is the default at time of writing, *if* any -std flag works (so that systems with compilers that do not provde -std could still attempt to compile Emacs). So, say that Emacs can use C99, C11 and C23 with extensions at the moment (which seems likely to be the case for Emacs 32), then the build system should try -std=gnu23, -std=gnu11 and -std=gnu99 in turn, and pass the first one that worked to the compiler. (The build system should also check __STDC_VERSION__ to ensure the flag actually had the desired effect) Should all of them fail to compile or have the desired effect, we don't know how to tell that compiler about what C dialects we expect, so we just don't and hope for the best (and perhaps print a configure-time warning). That way, should, say, C67 introduce a new keyword, that happens to clash with an identifier Emacs uses, Emacs will pass -std=c23 to the build system and thus the compiler would know not to enable the C67 keywords. -- Arsen Arsenović
signature.asc
(application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE----- iQECBAEWCgCqFiEE/uKz0RP8AKMWLWBhUsKUMB6ixJMFAmqAtTQbFIAAAAAABAAO bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRGRUUyQjNEMTEzRkMwMEEzMTYyRDYw NjE1MkMyOTQzMDFFQTJDNDkzEBxhcnNlbkBhYXJzZW4ubWUACgkQUsKUMB6ixJOA BwEArOUxBPAXjUxyEp82bHX6NkHALvw0qGoYGgVq167DjV8A/0cxFfZ33tatNR/J IBeVQDyjH8hAlsfS27FVJ0GgVMsP =OsPN -----END PGP SIGNATURE-----