summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <[email protected]>2017-04-11 18:36:30 +0200
committerUlf Hermann <[email protected]>2017-05-08 09:49:55 +0000
commitf2ef0e643716b480a8b4b4080680d0d95bede6f2 (patch)
tree32d2fc1ddaddfe7b323efa14a2b90188d88f739a
parent14192f5767b3388d9f6a1cdc8cadfb047b7a1f6a (diff)
Drop the trickery in printversion.h
The mechanism of moving argp_program_version_hook and argp_program_bug_address to .rodata is not portable and two pointers per program are not worth the effort to make it portable. Revert the pointers to be non-const. Change-Id: Iea458a5927cf31c72d972bc014229eb62fe2a5a5 Reviewed-by: Christian Kandeler <[email protected]>
-rw-r--r--lib/ChangeLog5
-rw-r--r--lib/printversion.h10
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog
index 59939bd1..0433f023 100644
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,10 @@
2017-05-04 Ulf Hermann <[email protected]>
+ * printversion.h: Define ARGP_PROGRAM_VERSION_HOOK_DEF and
+ ARGP_BUG_ADDRESS_DEF to be non-const and drop the asm tricks.
+
+2017-05-04 Ulf Hermann <[email protected]>
+
* system.h: Define FILE_SYSTEM_PREFIX_LEN, ISDIRSEP, DIRSEP, PATHSEP,
and IS_ABSOLUTE_PATH to help with handling file system paths.
diff --git a/lib/printversion.h b/lib/printversion.h
index a9e059ff..090b53ab 100644
--- a/lib/printversion.h
+++ b/lib/printversion.h
@@ -36,14 +36,10 @@
void print_version (FILE *stream, struct argp_state *state);
/* We need define two variables, argp_program_version_hook and
- argp_program_bug_address, in all programs. argp.h declares these
- variables as non-const (which is correct in general). But we can
- do better, it is not going to change. So we want to move them into
- the .rodata section. Define macros to do the trick. */
+ argp_program_bug_address, in all programs. */
#define ARGP_PROGRAM_VERSION_HOOK_DEF \
- void (*const apvh) (FILE *, struct argp_state *) \
- __asm ("argp_program_version_hook")
+ void (*argp_program_version_hook) (FILE *, struct argp_state *)
#define ARGP_PROGRAM_BUG_ADDRESS_DEF \
- const char *const apba__ __asm ("argp_program_bug_address")
+ const char *argp_program_bug_address
#endif // PRINTVERSION_H