Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8994261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:23:15+00:00 2026-06-15T23:23:15+00:00

I just had a redefine conflict in the project I’m working on and while

  • 0

I just had a redefine conflict in the project I’m working on and while tracing down why it’s not happening on all platforms (turned out to be to order of includes), I stumbled upon the following behavior which I cannot explain.

1. compiles without warnings

    #define LIST_HEAD(a) { int a = 0; }                                                                                                                     
    #include <sys/queue.h>                                                          

    int main() {                                                                    
        return 0;                                                               
    }

2. “macro redefined” warning

    #include <sys/queue.h>
    #define LIST_HEAD(a) { int a = 0; }                                                                                                       

    int main() {                                                                    
        return 0;                                                               
    }

I would expect both cases to produce the warning, since there’re no checks in <sys/queue.h> that would prevent a redefine.

So why does the first case produces no warning, while the second one does? What I’m missing here?

Btw: I get the same results on my Mac with clang and my Linux box with gcc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:23:17+00:00Added an answer on June 15, 2026 at 11:23 pm

    By default, this warning is suppressed in system headers. The code in <sys/queue.h> is considered to come from a system header because sys/queue.h was found by searching a path marked as containing system headers.

    So in (2) you see the warning because it is generated within your code, while in (1) the warning is generated within queue.h, and so is suppressed. Add -Wsystem-headers to your compilation options, and you’ll see the warning in both cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just had a FB app project turned over to me, and I'm trying
I just had a laptop crash (spilled water on it). I copied my working
I just had a hell of a project doing simple operations on C++, then
I just had a problem with a tree conflict in subversion/tortoisesvn. after a lot
I have a Perl project were I just had a problem by making a
I just had a quick question for all devs out there, what does +=
I just had a homework assignment that wanted me to add all the Java
I just had my capybara updated to 2.0, and all of my save_and_open_page calls
Just had a question about an odd runtime error that I'm having. I'm working
i just had a problem while debugging which i don't get: I'm using a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.