From d8b337d5e9befb16b24a9f9249a342949261f161 Mon Sep 17 00:00:00 2001 From: lurk101 Date: Tue, 1 Oct 2024 16:02:28 -0400 Subject: [PATCH] fix prev compiler error --- cc/cc.c | 4 ++-- cc/cc_extrns.h | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cc/cc.c b/cc/cc.c index 65e420a..65562e7 100644 --- a/cc/cc.c +++ b/cc/cc.c @@ -4214,8 +4214,8 @@ int cc(int mode, int argc, char** argv) { if (mode == 0) { // check that table is ordered for (int i = 1; i < NUMOF(externs); i++) - if (strcmp(externs[i - 1].name, externs[i].name) >= 0) - run_fatal("out of order starting at %s\n", externs[i].name); + if (strcmp(externs[i].name, externs[i - 1].name) <= 0) + run_fatal("out of order starting at %s\n %s", externs[i - 1].name, externs[i].name); // Register keywords in symbol table. Must match the sequence of enum p = "enum char int float struct union sizeof return goto break continue " "if do while for switch case default else void main"; diff --git a/cc/cc_extrns.h b/cc/cc_extrns.h index 1549c66..b0d5820 100644 --- a/cc/cc_extrns.h +++ b/cc/cc_extrns.h @@ -96,12 +96,13 @@ {"i2c_get_dreq", 2, i2c_defines, i2c_get_dreq, 0}, {"i2c_get_hw", 1, i2c_defines, i2c_get_hw, 0}, #if PICO_SDK_VERSION_MAJOR >= 2 - {"i3c_get_index", 1, i2c_defines, i2c_get_index, 0}, -#else - {"i2c_hw_index", 1, i2c_defines, i2c_hw_index, 0}, + {"i2c_get_index", 1, i2c_defines, i2c_get_index, 0}, #endif {"i2c_get_read_available", 1, i2c_defines, i2c_get_read_available, 0}, {"i2c_get_write_available", 1, i2c_defines, i2c_get_write_available, 0}, +#if PICO_SDK_VERSION_MAJOR < 2 + {"i2c_hw_index", 1, i2c_defines, i2c_hw_index, 0}, +#endif {"i2c_init", 2, i2c_defines, i2c_init, 0}, {"i2c_read_blocking", 5, i2c_defines, i2c_read_blocking, 0}, {"i2c_read_raw_blocking", 3, i2c_defines, i2c_read_raw_blocking, 0},