keirf / disk-utilities

The Unlicense
233 stars 51 forks source link

MacOS 14.6.1 compilation fails with error in amiga/okay_protection.c #213

Closed 0ddjob closed 2 months ago

0ddjob commented 2 months ago

Scratching my head a bit. Have cloned the repository and tried compiling from the repository root as per instructions, however fails with an error for file /libdisk/format/amiga/okay_protection.c.

gcc -O2 -fno-strict-aliasing -std=gnu99 -Wall -Werror -I../../libdisk/include -MMD -MF amiga/.okay_protection.opic.d  -fPIC -fvisibility=hidden -c -o amiga/okay_protection.opic amiga/okay_protection.c
amiga/okay_protection.c:23:9: error: variable 'counter' set but not used [-Werror,-Wunused-but-set-variable]
    int counter = 0;
        ^
1 error generated.
make[2]: *** [amiga/okay_protection.opic] Error 1
make[1]: *** [all] Error 2
make: *** [all] Error 2

When I check the source file I can see that the variable counter is used inside a while loop:

    /* GCR 4us bit time */
    stream_set_density(s, 4000);
    int counter = 0;
    while (stream_next_bit(s) != -1) {
        unsigned int i, count;
        counter++;

disk_utilities_compile_error_19-Aug-2024.txt

kkrellwitz commented 2 months ago

Will look into it tonight .

On Sun, Aug 18, 2024 at 11:18 PM Brett Hallen @.***> wrote:

Scratching my head a bit. Have cloned the repository and tried compiling from the repository root as per instructions, however fails with an error for file /libdisk/format/amiga/okay_protection.c.

gcc -O2 -fno-strict-aliasing -std=gnu99 -Wall -Werror -I../../libdisk/include -MMD -MF amiga/.okay_protection.opic.d -fPIC -fvisibility=hidden -c -o amiga/okay_protection.opic amiga/okay_protection.c amiga/okay_protection.c:23:9: error: variable 'counter' set but not used [-Werror,-Wunused-but-set-variable] int counter = 0; ^ 1 error generated. make[2]: [amiga/okay_protection.opic] Error 1 make[1]: [all] Error 2 make: *** [all] Error 2

When I check the source file I can see that the variable counter is used inside a while loop:

/* GCR 4us bit time */
stream_set_density(s, 4000);
int counter = 0;
while (stream_next_bit(s) != -1) {
    unsigned int i, count;
    counter++;

disk_utilities_compile_error_19-Aug-2024.txt https://github.com/user-attachments/files/16655716/disk_utilities_compile_error_19-Aug-2024.txt

— Reply to this email directly, view it on GitHub https://github.com/keirf/disk-utilities/issues/213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR5AMYYN5F2FQ7E6WRJEZDZSFWYPAVCNFSM6AAAAABMXA44BOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TENBSGA2TGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

kkrellwitz commented 2 months ago

Looks like I just need to remove the variable counter and the increment statement. The variable was used for debugging and forgot to remove it.

On Mon, Aug 19, 2024 at 4:28 PM Keith Krellwitz @.***> wrote:

Will look into it tonight .

On Sun, Aug 18, 2024 at 11:18 PM Brett Hallen @.***> wrote:

Scratching my head a bit. Have cloned the repository and tried compiling from the repository root as per instructions, however fails with an error for file /libdisk/format/amiga/okay_protection.c.

gcc -O2 -fno-strict-aliasing -std=gnu99 -Wall -Werror -I../../libdisk/include -MMD -MF amiga/.okay_protection.opic.d -fPIC -fvisibility=hidden -c -o amiga/okay_protection.opic amiga/okay_protection.c amiga/okay_protection.c:23:9: error: variable 'counter' set but not used [-Werror,-Wunused-but-set-variable] int counter = 0; ^ 1 error generated. make[2]: [amiga/okay_protection.opic] Error 1 make[1]: [all] Error 2 make: *** [all] Error 2

When I check the source file I can see that the variable counter is used inside a while loop:

/* GCR 4us bit time */
stream_set_density(s, 4000);
int counter = 0;
while (stream_next_bit(s) != -1) {
    unsigned int i, count;
    counter++;

disk_utilities_compile_error_19-Aug-2024.txt https://github.com/user-attachments/files/16655716/disk_utilities_compile_error_19-Aug-2024.txt

— Reply to this email directly, view it on GitHub https://github.com/keirf/disk-utilities/issues/213, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABR5AMYYN5F2FQ7E6WRJEZDZSFWYPAVCNFSM6AAAAABMXA44BOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ3TENBSGA2TGMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

0ddjob commented 2 months ago

Ach, sorry - I could've tried that myself! I'm mainly interested in Osborne 1 disk images at the moment so would never have used the Amiga stuff.

I was wondering if the WHILE loop was never triggered, thus the counter variable never actually used ... hence the compile error ... ?

Anyway, tried it now and compiles nicely! Thanks.

    /* GCR 4us bit time */
    stream_set_density(s, 4000);
    while (stream_next_bit(s) != -1) {
        unsigned int i, count;
        if ((uint16_t)s->word != 0xbdef)
            continue;

disk-utilties_compile_OK_20-Aug-2024.txt