Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default options GCC

Tags:

c

linux

gcc

I'm working on Linux with C on this file:

#include "headerFiles.h"

#define TRUE  1
#define FALSE 0
#define BUFSIZE 256
#define SERVER_PORT 8887

int main (int argc, char *argv[])
{
    signal(SIGCHLD, SIG_IGN);

    int ls; // listen socket
    int s;  // descrittore socket
    int n;  // byte letti inviati
    int waitSize; // massimo numero persone in coda

    struct sockaddr_in serverAddr;
    struct sockaddr_in clientAddr;

    int clientAddrLen = sizeof( clientAddr );

    memset(&serverAddr,0,sizeof(serverAddr));

    serverAddr.sin_family = AF_INET;
    serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
    serverAddr.sin_port = htons(SERVER_PORT);

    if( (ls = socket(AF_INET,SOCK_STREAM,0)) < 0) {

        perror("Errore: creazione della socket di asolto fallita!");
        exit(1);
    }

    int so_reuseaddr = TRUE;

    if( fork() == 0) {

        //---------------------------------------------------//
        //CODICE
        while (1) {

            char cmd[BUFSIZE];
            char var1[BUFSIZE];
            char var2[BUFSIZE];
            char string[100];

            memset(cmd, 0, sizeof(cmd));
            memset(var1, 0, sizeof(var1));
            memset(var2, 0, sizeof(var2));
            memset(string, 0, sizeof(string));
        }
    }

    close(s);
    exit(0);
}

This code represent a mini-Server on C but I have this problem: How do I check if I have default gcc compiler options?

Because, for example, on Mac I get some warnings and on Linux not.

UPDATE:

for compile I use this makefile:

elaborato: *.c *.h
    gcc *.c -o elaborato

and when I execute it I do: ./elaborato

I want to compile this program using default gcc settings. it's enough this?

like image 658
gino gino Avatar asked Jul 21 '26 05:07

gino gino


1 Answers

For GCC on Linux:

> gcc -Q --help=target

will produce list of options with enabled|disabled flag

like image 86
Severin Pappadeux Avatar answered Jul 22 '26 17:07

Severin Pappadeux



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!