Community
Participate
Working Groups
Created attachment 238990 [details] Eclipse plugin that implements a resource filter to reproduce this bug Resource specific toolchain settings removed with (CDT)configuration specific resource filter How to reproduce: * Create an Eclipse-Plugin, implementing a resource filter (extension point 'org.eclipse.core.resources.filterMatchers'). That filter should "filter certain resources (i.e. a .cpp or a folder) depending on the active configuration" * Create a C/C++ project that contains a resource that get's filtered out for a certain configuration * Set file specific toolchain settings for that file that'll be filtered out for a certain configuration (e.g. set a compiler directive for that file) * Switch the configuration so that the file with the specific toolchain settings will be filtered out (means: is not visible in the Project Explorer anymore) * (maybe manually start a refresh on the project level to actually cause the resources to disappear - this may be worth filing another bug?) * Switch back to the previous configuration (in which the file re-appears) * (maybe manually start a refresh on the project level to actually cause the resources to disappear - this may be worth filing another bug?) => BUG: The resource specific settings have been removed! In order to make it easier to reproduce the problem, I attached: * An Eclipse plugin implementing such a filter * A CDT project containing a "filtered resource (1 .c file an 1 folder) with resource specific settings" Root cause: The code that causes the resource specific settings to be removed is located in org.eclipse.cdt.internal.core.settings.model.ResourceChangeHandler.RcMoveHandler.done(). That code intentionally removes all file specific settings for resources that got (re)moved. It does this for all configurations of a project. In other words: That piece of code assumes that all configurations of a project are using the same resources - which is not necessarily the case, as shown with the use case of a custom resource filters. Other side-effects: Beside removing file specific settings, this also causes changes in the .cproject file whenever changin the active configuration... Fixes I can think of: a) Remove resource specific settings only for "*removed* resources" if the resource is not filtered out b) Remove resource specific settings only for "*removed* resources" if the resource doesn't exist on the file system anymore c) Remove resource specific settings only for the active configuration (instead of "all configurations) Personally, I prefer a) or b). I could push a patch to gerrit, once we've decided how to fix the issue. Probably relevant/similar bugs: 311189, 317783 and 348569.
Created attachment 238991 [details] Sample CDT project to reproduce the bug
Created attachment 238992 [details] Proposed patch for a)
Created attachment 238993 [details] Proposed patch for b)
Created attachment 238994 [details] Proposed patch for c)
I just reproduced this bug with today's master.
Please consider submitting your patches via Gerrit: https://wiki.eclipse.org/CDT/git#Using_Gerrit_for_CDT