This might be considered over the top by some(?), but it'd be nice if a dev could clean up the warnings the core ml code has when compiled with -Wall ... it's mostly -Wformat stuff that can be cleaned up with an explicit cast.
Yes, I could simply disable this warning, but if adding code to the ml core I want to see all warnings in case I break something - so if anyone volunteers who has write access to the repo and doesn't have to go through a lengthy pull process - go ahead :-)
Do you have a patch already?
Quote from: nanomad on October 12, 2013, 03:02:49 PM
Do you have a patch already?
Nope, I'm not good enough at C to fix these compiler warnings correctly (otherwise I wouldn't have requested it here) - but 1% recently fixed a lot of warnings in his TL fork which might filter down eventually to the good ol' ML.
https://bitbucket.org/OtherOnePercent/tragic-lantern-6d/commits/e9f3214ad95f441813ceeb2cda975c7e94a7aed9
here you go
diff --git a/src/audio-common.c b/src/audio-common.c
--- a/src/audio-common.c
+++ b/src/audio-common.c
@@ -165,7 +165,7 @@
int meter_height,
struct audio_level * level,
char * label,
- int width
+ unsigned int width
)
{
const uint32_t pitch = BMPPITCH;
diff --git a/src/bitrate.c b/src/bitrate.c
--- a/src/bitrate.c
+++ b/src/bitrate.c
@@ -29,7 +29,7 @@
#endif
static int time_indic_warning = 120;
-static int time_indic_font = FONT(FONT_MED, COLOR_RED, COLOR_BLACK );
+static unsigned int time_indic_font = FONT(FONT_MED, COLOR_RED, COLOR_BLACK );
static int measured_bitrate = 0; // mbps
//~ int free_space_32k = 0;
diff --git a/src/menu.c b/src/menu.c
--- a/src/menu.c
+++ b/src/menu.c
@@ -2391,7 +2391,7 @@
static void
menu_post_display()
{
- char* cfg_preset = get_config_preset_name();
+ char* cfg_preset = (char*)get_config_preset_name();
if (cfg_preset && !submenu_mode)
{
bmp_printf(
diff --git a/src/shoot.c b/src/shoot.c
--- a/src/shoot.c
+++ b/src/shoot.c
@@ -203,6 +203,30 @@
static int timer_values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 25, 26, 27, 28, 29, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 135, 150, 165, 180, 195, 210, 225, 240, 270, 300, 360, 420, 480, 540, 600, 660, 720, 780, 840, 900, 1200, 1800, 2700, 3600, 5400, 7200, 9000, 10800, 14400, 18000, 21600, 25200, 28800};
+#ifdef FEATURE_INTERVALOMETER
+int get_interval_count()
+{
+ return intervalometer_pictures_taken;
+}
+
+int get_interval_time()
+{
+ if(interval_time == -1)
+ interval_time = timer_values[interval_timer_index];
+ return interval_time;
+}
+
+void set_interval_time(int seconds)
+{
+ interval_time = seconds;
+}
+
+void set_interval_index(int index)
+{
+ interval_time = timer_values[index];
+}
+#endif
+
static const char* format_time_hours_minutes_seconds(int seconds)
{
static char msg[50];
@@ -4662,28 +4686,6 @@
#ifdef FEATURE_INTERVALOMETER
-int get_interval_count()
-{
- return intervalometer_pictures_taken;
-}
-
-int get_interval_time()
-{
- if(interval_time == -1)
- interval_time = timer_values[interval_timer_index];
- return interval_time;
-}
-
-void set_interval_time(int seconds)
-{
- interval_time = seconds;
-}
-
-void set_interval_index(int index)
-{
- interval_time = timer_values[index];
-}
-
// create a post script for sorting intervalometer sequences,
// starting from file number f0 till the current file_number
void interval_create_script(int f0)
diff --git a/src/tweaks.c b/src/tweaks.c
--- a/src/tweaks.c
+++ b/src/tweaks.c
@@ -3670,7 +3670,7 @@
#ifdef FEATURE_IMAGE_ORIENTATION
{
.name = "Orientation",
- .priv = &DISPLAY_ORIENTATION,
+ .priv = (int*)&DISPLAY_ORIENTATION,
.select = display_orientation_toggle,
.max = 2,
.choices = (const char *[]) {"Normal", "Reverse", "Mirror"},
diff --git a/src/vram.c b/src/vram.c
--- a/src/vram.c
+++ b/src/vram.c
@@ -577,7 +577,7 @@
int vram_redirect_lv_buffer(void* new_address)
{
#ifdef CONFIG_CAN_REDIRECT_DISPLAY_BUFFER_EASILY
- YUV422_LV_BUFFER_DISPLAY_ADDR = new_address;
+ YUV422_LV_BUFFER_DISPLAY_ADDR = (int)new_address;
return 1;
#else
return 0;
diff --git a/src/zebra.c b/src/zebra.c
--- a/src/zebra.c
+++ b/src/zebra.c
@@ -1311,7 +1311,7 @@
//~ #else
#if defined(RSCMGR_MEMORY_PATCH_END)
extern unsigned int ml_reserved_mem;
- bvram_mirror_start = RESTARTSTART + ml_reserved_mem;
+ bvram_mirror_start = (uint8_t*) (RESTARTSTART + ml_reserved_mem);
#elif defined(CONFIG_EOSM)
bvram_mirror_start = (void*)malloc(BMP_VRAM_SIZE); // malloc is big!
#else
Thats the rest of it? I think I only have the vram one left along with the switched interval index.
Well, there's one in boothack that complains about _reloc not being used. Easy to fix but I didn't b/c I wasn't sure if it "should" be fixed or what's the purpose of that var to begin with.
This would do it:
static uint8_t* do_not_use_this_function()
{
return _reloc;
}
There might also be some in cameras I don't compile for, I didn't check.
I fixed it like this:
Quote
#ifndef HIJACK_CACHE_HACK
/** This just goes into the bss */
#define RELOCSIZE 0x3000 // look in HIJACK macros for the highest address, and subtract ROMBASEADDR
static uint8_t _reloc[ RELOCSIZE ];
#define RELOCADDR ((uintptr_t) _reloc)
#endif
Haven't tried it myself yet, but dmilligan has a pull request (https://bitbucket.org/hudson/magic-lantern/pull-request/266/fix-compiler-warnings/diff) for this.